Skip to main content
18 events
when toggle format what by license comment
Apr 3, 2017 at 10:22 history edited TimRias CC BY-SA 3.0
Correct machineprecision behavior
Apr 3, 2017 at 9:29 history edited TimRias CC BY-SA 3.0
code typo
Apr 3, 2017 at 7:14 comment added TimRias @xzczd It is indeed the case that the absolute tolerance ε is no longer 10^(-$MachinePrecision/2) in that case. But the "effective precision" ep as it appears in the mock function is still $MachinePrecision/2. That is where the division by Abs[a]+Abs[b] comes in. (Actually I've found that it is not quite $MachinePrecision/2, but somewhere close to that, i.e. within 1%.
Apr 3, 2017 at 7:09 history edited TimRias CC BY-SA 3.0
Divide by |a|+|b| instead of |a+b|, see comments
Apr 2, 2017 at 7:44 comment added xzczd I'm afraid the guess ε = 10^(-$MachinePrecision/2) is incorrect, if you modify tf to tf[tol_?NumericQ, prec_?NumericQ, digit_?NumericQ] := Internal`CompareNumeric[tol, SetPrecision[100, prec], SetPrecision[100, prec] + 10^-SetPrecision[digit, 100]], you will find the split digit seems to become $MachinePrecision/2 - 2
Mar 30, 2017 at 11:37 comment added TimRias Note that the mock function easily reproduces the odd behavior observed in the other answers.
Mar 30, 2017 at 11:34 history edited TimRias CC BY-SA 3.0
addendum on what this means
Mar 30, 2017 at 11:11 comment added TimRias @Shadowray: I guess the denominator may need to be Abs[a]+Abs[b] rather than Abs[a+b]
Mar 30, 2017 at 11:09 history edited TimRias CC BY-SA 3.0
x -> p
Mar 30, 2017 at 9:36 comment added Ray Shadow What if one evaluates MockCompareNumeric[5, -0.9252872333493522561`2., 0.9289648686205458361`3.] ?
Mar 30, 2017 at 8:58 history edited TimRias CC BY-SA 3.0
mock function
Mar 29, 2017 at 16:07 history edited xzczd CC BY-SA 3.0
added 5 characters in body
Mar 29, 2017 at 14:06 comment added TimRias @ J.M. Ah, I see. Well, in this case we are not interested in finding the threshold where the two numbers are no longer considered the "same" by Internal`CompareNumeric which is a slightly different question, than find the threshold where the internal representation becomes the same. (Arbitrary precision numbers in Mathematica can have many more digits in their internal representation than their actual precision value.)
Mar 29, 2017 at 13:58 comment added J. M.'s missing motivation You mentioned wanting to find the threshold value where two numbers are no longer the same, so I think a function that would give the "next" floating point number might suit your needs.
Mar 29, 2017 at 13:55 comment added TimRias @ J.M. No I hadn't. I am also not sure why you are pointing to it. Could you explain?
Mar 29, 2017 at 13:46 history edited TimRias CC BY-SA 3.0
finish premature post
Mar 29, 2017 at 13:25 comment added J. M.'s missing motivation Have you seen this, by any chance?
Mar 29, 2017 at 13:21 history answered TimRias CC BY-SA 3.0