Re: Mathematica not IEEE-754 compliant?
- To: mathgroup at smc.vnet.net
- Subject: [mg131926] Re: Mathematica not IEEE-754 compliant?
- From: danl at wolfram.com
- Date: Wed, 30 Oct 2013 23:45:35 -0400 (EDT)
- Delivered-to: email@example.com
- Delivered-to: firstname.lastname@example.org
- Delivered-to: email@example.com
- Delivered-to: firstname.lastname@example.org
- References: <email@example.com>
I'm not convinced that one or the other is incorrect. It could be the case, for example, that 80 bit registers at certain steps are required to get one result whereas 64 bit registers, or storing from 80 to 64 bit doubles in memory, will give the other. Whether or how 80 bit registers get used will depend on settings at compile time for the various programs being used. One thing I can point out is that the Mathematica result is arguably the better of the two. Once you create 'num' and 'den' as machine numbers, if you now take their bit sequences, make exact rationals, and divide to high precision, then create the bit sequence for the corresponding approximate value, you will recover the 'bin' set of bits, not that of 'presumablyClosestInfPrec'. I show this below. In:= Take[ RealDigits[ N[FromDigits[RealDigits[num, 2], 2]/ FromDigits[RealDigits[den, 2], 2], 20], 2][], 53] === bin[] Out= True Notice that I used N[...,20] to make sure to correctly reconstruct that (exact) quotient to more than 53 correct bits. Daniel Lichtblau Wolfram Research