Accessing bit fields in floating point values

Questions about the BASICtools and MakeItC
Post Reply
YahooArchive
Posts: 1463
Joined: Fri Oct 19, 2012 5:11 am

Accessing bit fields in floating point values

Post by YahooArchive » Tue Feb 12, 2013 1:52 pm

>from the help line
>How do I access the mantissa and exponent fields of the 32bit word?
>I don't see how to fool the compiler into allowing boolean ops on an FP word.

You fool the compiler (which is how I describe it as well) the same way as in C

C --

i = * (int *) &x; // need type casts in C

BASIC --

i = * (addressof x)

Now you can do bit field tests on the integer. This is how we do detection of
Inf and NaN -- infinity and not-a-number, which happens when you exceed the
E+/-38 range of floating points.



Post Reply