[#9722] Kernel#system broken inside Dir.chdir(&block) if system command doesn't have shell characters — <noreply@...>

Bugs item #7278, was opened at 2006-12-14 13:59

8 messages 2006/12/14

[#9749] System V IPC in standard library? — Steven Jenkins <steven.jenkins@...>

Back in August, I needed a semaphore to serialize access to an external

14 messages 2006/12/19

[#9753] CVS freeze — SASADA Koichi <ko1@...>

Hi,

20 messages 2006/12/20
[#9755] Re: [ruby-dev:30039] CVS freeze — SASADA Koichi <ko1@...> 2006/12/20

Hi,

[#9757] Re: [ruby-dev:30040] Re: CVS freeze — SASADA Koichi <ko1@...> 2006/12/20

Hi,

Re: Float numbers comparison

From: Kornelius Kalnbach <murphy@...>
Date: 2006-12-02 04:09:49 UTC
List: ruby-core #9657
> a=1.9
> b= 1.8 +0.1
> puts a==b  #false
The Test::Unit library provides a special method to deal with that  
technical issue, called
assert_in_delta:

   Passes if +expected_float+ and +actual_float+ are equal
   within +delta+ tolerance.

   Example:
     assert_in_delta 0.05, (50000.0 / 10**6), 0.00001

Inside, it's using this formula:

   (expected_float.to_f - actual_float.to_f).abs <= delta.to_f

You can easily make a new Float#about_equal method out of this, or  
you use Float#===,
or even overwrite Float#==.

Or, if you prefer calculating with fractions, you can use the  
Rational library.

However, I wonder what the Float::EPSILON constant is about. Can it  
be used as a sensible
default tolerance delta?

1.0 / (1.0 / 0.0) == 0.0   # ^^
[murphy]

In This Thread