From: nobu.nokada@... Date: 2003-04-21T00:07:40+09:00 Subject: Re: Roundoff problem with Float and Marshal Hi, At Fri, 18 Apr 2003 23:53:48 +0900, Rudi Cilibrasi wrote: > I believe the idea itself is endian-safe, and the patch as posted > it almost safe. It does not assume a binary format, it checks; The line > if (b[0] == 0xc8b43958 && b[1] == 0x3ff3be76) > may need to be adjusted to include the check that it is a little-endian > machine (if floating point numbers are reversed on big-endian machines). It works only with IEEE754. It is the reason I called it "less portable". > I don't want to solve the problem for every machine to convert > between little and big endian. I just want it to work on the most common > machine, the one I am using, and not break the others. I am confident it > won't break the other platforms because they will set the floatingType > bits to FT_OTHER, which means that the 2 binary bytes at the end are > simply ignored, and so we are back to the original behavior. I'm not against that point. > The important point would be that the least significant floating-point > mantissa 8 bits are put in the first byte, then the next least significant > 6 bits in the second byte. This is endian-safe so long as you put them > back right, and are using IEEE754. Sorry, but I can't understand why you call it endian-safe. It seems to definitely depend on the endian. -- Nobu Nakada