Skip to main content
added 143 characters in body
Source Link
Greg Hurst
  • 36.8k
  • 1
  • 94
  • 143

You can lower the value of Internal`$EqualToleranceInternal`$EqualTolerance:

Block[{Internal`$EqualTolerance = 0},
  0.999999999999988 >= 1.0 
]
False

This can lead to unexpected behaviors too:

Block[{Internal`$EqualTolerance = 0},
  0.1 + 0.2 == 0.3 
]
False

Maybe there's a better sweet spot that fits your needs. For these two examples, this works:

Block[{Internal`$EqualTolerance = Internal`$SameQTolerance},
  0.999999999999988 >= 1.0 
]
False
Block[{Internal`$EqualTolerance = Internal`$SameQTolerance},
  0.1 + 0.2 == 0.3 
]
True

If you have a nice representative sample of values you're comparing, you can estimate a value for Internal`$EqualTolerance by plotting. These two examples return correct comparisons for values between Log10[5/3] and Log10[108]:

correctEquals[x_?NumericQ] := 
  Block[{Internal`$EqualTolerance = x}, 
    Boole[Not[0.999999999999988 >= 1.0] && (0.1 + 0.2 == 0.3)]
  ]

Plot[correctEquals[x], {x, 0, Internal`$EqualTolerance}]

You can lower the value of Internal`$EqualTolerance:

Block[{Internal`$EqualTolerance = 0},
  0.999999999999988 >= 1.0 
]
False

This can lead to unexpected behaviors too:

Block[{Internal`$EqualTolerance = 0},
  0.1 + 0.2 == 0.3 
]
False

Maybe there's a better sweet spot that fits your needs. For these two examples, this works:

Block[{Internal`$EqualTolerance = Internal`$SameQTolerance},
  0.999999999999988 >= 1.0 
]
False
Block[{Internal`$EqualTolerance = Internal`$SameQTolerance},
  0.1 + 0.2 == 0.3 
]
True

If you have a nice representative sample of values you're comparing, you can estimate a value for Internal`$EqualTolerance by plotting. These two examples return correct comparisons for values between Log10[5/3] and Log10[108]:

correctEquals[x_?NumericQ] := 
  Block[{Internal`$EqualTolerance = x}, 
    Boole[Not[0.999999999999988 >= 1.0] && (0.1 + 0.2 == 0.3)]
  ]

Plot[correctEquals[x], {x, 0, Internal`$EqualTolerance}]

You can lower the value of Internal`$EqualTolerance:

Block[{Internal`$EqualTolerance = 0},
  0.999999999999988 >= 1.0 
]
False

This can lead to unexpected behaviors too:

Block[{Internal`$EqualTolerance = 0},
  0.1 + 0.2 == 0.3 
]
False

Maybe there's a better sweet spot that fits your needs. For these two examples, this works:

Block[{Internal`$EqualTolerance = Internal`$SameQTolerance},
  0.999999999999988 >= 1.0 
]
False
Block[{Internal`$EqualTolerance = Internal`$SameQTolerance},
  0.1 + 0.2 == 0.3 
]
True

If you have a nice representative sample of values you're comparing, you can estimate a value for Internal`$EqualTolerance by plotting. These two examples return correct comparisons for values between Log10[5/3] and Log10[108]:

correctEquals[x_?NumericQ] := 
  Block[{Internal`$EqualTolerance = x}, 
    Boole[Not[0.999999999999988 >= 1.0] && (0.1 + 0.2 == 0.3)]
  ]

Plot[correctEquals[x], {x, 0, Internal`$EqualTolerance}]

added 8 characters in body
Source Link
Greg Hurst
  • 36.8k
  • 1
  • 94
  • 143

You can lower the value of Internal`$EqualTolerance:

Block[{Internal`$EqualTolerance = 0},
  0.999999999999988 >= 1.0 
]
False

This can lead to unexpected behaviors too:

Block[{Internal`$EqualTolerance = 0},
  0.1 + 0.2 == 0.3 
]
False

Maybe there's a better sweet spot that fits your needs. For these two examples, this works:

Block[{Internal`$EqualTolerance = Internal`$SameQTolerance},
  0.999999999999988 >= 1.0 
]
False
Block[{Internal`$EqualTolerance = Internal`$SameQTolerance},
  0.1 + 0.2 == 0.3 
]
True

If you have a nice representative sample of values you're comparing, you can estimate a value for Internal`$EqualTolerance by plotting. These two examples return correct comparisons for values roughly between 0.22Log10[5/3] and 2.03Log10[108]:

correctEquals[x_?NumericQ] := 
  Block[{Internal`$EqualTolerance = x}, 
    Boole[Not[0.999999999999988 >= 1.0] && (0.1 + 0.2 == 0.3)]
  ]

Plot[correctEquals[x], {x, 0, Internal`$EqualTolerance}]

You can lower the value of Internal`$EqualTolerance:

Block[{Internal`$EqualTolerance = 0},
  0.999999999999988 >= 1.0 
]
False

This can lead to unexpected behaviors too:

Block[{Internal`$EqualTolerance = 0},
  0.1 + 0.2 == 0.3 
]
False

Maybe there's a better sweet spot that fits your needs. For these two examples, this works:

Block[{Internal`$EqualTolerance = Internal`$SameQTolerance},
  0.999999999999988 >= 1.0 
]
False
Block[{Internal`$EqualTolerance = Internal`$SameQTolerance},
  0.1 + 0.2 == 0.3 
]
True

If you have a nice representative sample of values you're comparing, you can estimate a value for Internal`$EqualTolerance by plotting. These two examples return correct comparisons for values roughly between 0.22 and 2.03:

correctEquals[x_?NumericQ] := 
  Block[{Internal`$EqualTolerance = x}, 
    Boole[Not[0.999999999999988 >= 1.0] && (0.1 + 0.2 == 0.3)]
  ]

Plot[correctEquals[x], {x, 0, Internal`$EqualTolerance}]

You can lower the value of Internal`$EqualTolerance:

Block[{Internal`$EqualTolerance = 0},
  0.999999999999988 >= 1.0 
]
False

This can lead to unexpected behaviors too:

Block[{Internal`$EqualTolerance = 0},
  0.1 + 0.2 == 0.3 
]
False

Maybe there's a better sweet spot that fits your needs. For these two examples, this works:

Block[{Internal`$EqualTolerance = Internal`$SameQTolerance},
  0.999999999999988 >= 1.0 
]
False
Block[{Internal`$EqualTolerance = Internal`$SameQTolerance},
  0.1 + 0.2 == 0.3 
]
True

If you have a nice representative sample of values you're comparing, you can estimate a value for Internal`$EqualTolerance by plotting. These two examples return correct comparisons for values between Log10[5/3] and Log10[108]:

correctEquals[x_?NumericQ] := 
  Block[{Internal`$EqualTolerance = x}, 
    Boole[Not[0.999999999999988 >= 1.0] && (0.1 + 0.2 == 0.3)]
  ]

Plot[correctEquals[x], {x, 0, Internal`$EqualTolerance}]

added 470 characters in body
Source Link
Greg Hurst
  • 36.8k
  • 1
  • 94
  • 143

You can lower the value of Internal`$EqualTolerance:

Block[{Internal`$EqualTolerance = 0},
  0.999999999999988 >= 1.0 
]
False

This can lead to unexpected behaviors too:

Block[{Internal`$EqualTolerance = 0},
  0.1 + 0.2 == 0.3 
]
False

Maybe there's a better sweet spot that fits your needs. For these two examples, this works:

Block[{Internal`$EqualTolerance = Internal`$SameQTolerance},
  0.999999999999988 >= 1.0 
]
False
Block[{Internal`$EqualTolerance = Internal`$SameQTolerance},
  0.1 + 0.2 == 0.3 
]
True

If you have a nice representative sample of values you're comparing, you can estimate a value for Internal`$EqualTolerance by plotting. These two examples return correct comparisons for values roughly between 0.22 and 2.03:

correctEquals[x_?NumericQ] := 
  Block[{Internal`$EqualTolerance = x}, 
    Boole[Not[0.999999999999988 >= 1.0] && (0.1 + 0.2 == 0.3)]
  ]

Plot[correctEquals[x], {x, 0, Internal`$EqualTolerance}]

You can lower the value of Internal`$EqualTolerance:

Block[{Internal`$EqualTolerance = 0},
  0.999999999999988 >= 1.0 
]
False

This can lead to unexpected behaviors too:

Block[{Internal`$EqualTolerance = 0},
  0.1 + 0.2 == 0.3 
]
False

Maybe there's a better sweet spot that fits your needs. For these two examples, this works:

Block[{Internal`$EqualTolerance = Internal`$SameQTolerance},
  0.999999999999988 >= 1.0 
]
False
Block[{Internal`$EqualTolerance = Internal`$SameQTolerance},
  0.1 + 0.2 == 0.3 
]
True

You can lower the value of Internal`$EqualTolerance:

Block[{Internal`$EqualTolerance = 0},
  0.999999999999988 >= 1.0 
]
False

This can lead to unexpected behaviors too:

Block[{Internal`$EqualTolerance = 0},
  0.1 + 0.2 == 0.3 
]
False

Maybe there's a better sweet spot that fits your needs. For these two examples, this works:

Block[{Internal`$EqualTolerance = Internal`$SameQTolerance},
  0.999999999999988 >= 1.0 
]
False
Block[{Internal`$EqualTolerance = Internal`$SameQTolerance},
  0.1 + 0.2 == 0.3 
]
True

If you have a nice representative sample of values you're comparing, you can estimate a value for Internal`$EqualTolerance by plotting. These two examples return correct comparisons for values roughly between 0.22 and 2.03:

correctEquals[x_?NumericQ] := 
  Block[{Internal`$EqualTolerance = x}, 
    Boole[Not[0.999999999999988 >= 1.0] && (0.1 + 0.2 == 0.3)]
  ]

Plot[correctEquals[x], {x, 0, Internal`$EqualTolerance}]

added 470 characters in body
Source Link
Greg Hurst
  • 36.8k
  • 1
  • 94
  • 143
Loading
Source Link
Greg Hurst
  • 36.8k
  • 1
  • 94
  • 143
Loading