Re: Big/little endian conversion



Gianni Mariani <gi2nospam@xxxxxxxxxx> writes:

> David Schwartz wrote:
>> "Gianni Mariani" <gi2nospam@xxxxxxxxxx> wrote in message
> ...
>> Why? When you can write clearer, easier to understand and
>> maintain code that will work regardless of the system's native
>> format. What's the advantage?
>
> Little endian and big endian are well defined for integral types. Is
> there a clear spec for IEEE formatted floating point representations ?

Yes.

The question is whether the target processor/compiler respect them.

Actually, I don't remember any bytesex consideration in the IEEE stuff
I read.

I assume an abstract bit field is used to encode an IEEE floating
point number, and some processors choose to store this bit field as a
bytesexed integer instead of storing the bits in the same order as the
others.


> So, if I was too lazy to look it up (which I usually am), the code
> posted by Bjorn Reese would work.
>
> In Bjorn's code, the knowledge of how the floating point layout works
> is extracted from the compiler itself.
>
> I'll take back my previous comment on being able to find broken
> assumtions by a few judicios assert calls.


--
__Pascal Bourguignon__ http://www.informatimago.com/

"You question the worthiness of my code? I should kill you where you
stand!"
.



Relevant Pages

  • Re: Free Floating Point VHDL Library
    ... as a wrapper around the core floating point elements currently in ... and floating point ... code to synthesize. ... The VHDL-93 versions of the packages had the IEEE copyright removed from ...
    (comp.lang.vhdl)
  • Re: Win32Forth & negative zero
    ... or the IEEE? ... Theoretically RNE introduces less bias. ... As for floating point in software, ... In the main float wordset "round to nearest" would be ...
    (comp.lang.forth)
  • Re: Spartns (fast and flexible tensor representation for Common Lisp)
    ... distinct floating point types. ... The ANSI spec gives a lot of leeway in some areas, ... obvious correspondence between Lisp types and IEEE 754 types, ...
    (comp.lang.lisp)
  • Re: transfer from real to logical
    ... They might be different on hardware with more than one floating ... VAX does not support any IEEE formats, ... For double precision there are ...
    (comp.lang.fortran)
  • Re: Floating Point: Binary Shift Subroutine
    ... If it is IEEE, then you can ignore pretty much everything below as being ... Don't even try to interpret them as a floating point ... Certainly never do arithmetic with reals (and ... Convert the BAM stuff to "native" double precision values as soon as ...
    (comp.lang.fortran)