Timeline for Does Mathematica have an equivalent of C's nextafter?
Current License: CC BY-SA 3.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 10, 2016 at 7:23 | answer | added | Alexey Popkov | timeline score: 2 | |
Jun 10, 2016 at 7:05 | answer | added | jkuczm | timeline score: 5 | |
Aug 15, 2015 at 7:30 | answer | added | J. M.'s missing motivation♦ | timeline score: 6 | |
May 24, 2015 at 14:01 | history | tweeted | twitter.com/#!/StackMma/status/602474577583853568 | ||
May 24, 2015 at 12:34 | answer | added | Michael E2 | timeline score: 7 | |
May 24, 2015 at 6:08 | history | edited | J. M.'s missing motivation♦ |
edited tags
|
|
May 24, 2015 at 5:52 | history | edited | David Zhang | CC BY-SA 3.0 |
added edit explaining subtleties of floating-point representation
|
May 24, 2015 at 5:43 | comment | added | kirma |
You can also consider doing something like {IntegerPart[#1/$MachineEpsilon], #2} & @@ MantissaExponent[x, 2] to split the floating point number to integer-valued components and working further with those.
|
|
May 24, 2015 at 5:42 | comment | added | David Zhang |
@ciao Ulp is definitely a step in the right direction, but I'm not sure how to use it to implement nextafter . In particuar, I'm not sure how to handle the transitions between one exponent value and the next; note that 1.0 + Ulp[1.0] == 1.0 while 1.0 - Ulp[1.0] != 1.0 .
|
|
May 24, 2015 at 5:41 | comment | added | David Zhang |
@J. M. I still don't believe it would; the gap between 1.0e300 and the next floating-point value is a lot larger than $MachineEpsilon . In general, the gaps between consecutive floating-point numbers change with the magnitude of the numbers.
|
|
May 24, 2015 at 5:38 | comment | added | J. M.'s missing motivation♦ | You're right, for numbers in $(-1, 1)$, adding an appropriate signed machine epsilon would not be applicable. But at least for numbers outside that range, the last one would work. | |
May 24, 2015 at 5:28 | comment | added | ciao |
Have a look at Ulp et al. in the Computer Arithmetic package...
|
|
May 24, 2015 at 5:01 | comment | added | David Zhang | @J. M. If I understand correctly, incrementing/decrementing a float is a rather nontrivial task using only floating-point arithmetic operations. It's much easier with bit-level access to the internal representation of a number, which I can't figure out how to get in Mathematica. | |
May 24, 2015 at 4:56 | comment | added | David Zhang |
@J. M. Not quite. $MachineEpsilon is the smallest floating-point number such that 1 + $MachineEpsilon != 1 , but for certain values, the distance to the next representable float is much smaller. For example, consider the distance between 1.0e-300 and the next number up.
|
|
May 24, 2015 at 4:55 | comment | added | J. M.'s missing motivation♦ |
x + Sign[y] $MachineEpsilon should work, yes?
|
|
May 24, 2015 at 4:43 | history | asked | David Zhang | CC BY-SA 3.0 |