commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Jackson" <foamd...@gmail.com>
Subject Re: [math][patch] Mantissa + Characteristic methods for MathUtils
Date Tue, 26 Sep 2006 04:00:50 GMT
> Best I've found on the net uses some bit arithmetic.
>
> long bits = Double.doubleToLongBits(5894.349580349);
>
> boolean negative = (bits & 0x8000000000000000L) != 0;
> long exponent = bits & 0x7ff0000000000000L >> 52;
> long mantissa = bits & 0x000fffffffffffffL;

Yep, that's about what I got from the Java5 API.  It's awfully obtuse,
and thoroughly non-intuitive.

Oh well,

Kev

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message