Float.intBitsToFloat detail

Archie Cobbs archie at whistle.com
Mon Apr 19 17:20:01 PDT 1999


Bernd Kreimeier writes:
> While doing something OpenGL related (interleaved
> float/int arrays) I stumbled over a detail of the
> 
>   native float Float.intBitsToFloat(int)
> 
> implementation: that all IEEE 754 NaN values (2^23)
> are mapped to Float.NaN.
> 
> Might be worth a Mauve check?
> 
> A native method 
> 
>    jfloat Java_jni_Native_int2float( jint val ) {
>        return *((jfloat*)&val);
>    }
> 
> might produce float numbers that might break float
> code that relies on IEEE NaN always being Float.NaN?

Our stuff was written according to this spec:

  http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Float.html

This should explain what we do .. in particular, mapping all int
values to the same Float.NaN float value is required behavior.

-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com


More information about the kaffe mailing list