mantissa

Using C: How can I determine the sizes of the components of a floating point?

I am looking for suggestions on how to find the sizes (in bits) and range of floating point numbers in an architecture independent manner. The code could be built on various platforms (AIX, Linux, HPUX, VMS, maybe Windoze) using different flags - so results should vary. The sign, I've only seen as one bit, but how to measure the size o...

How to detect mantissa precision overflow in GMP, before or after it happens?

The question I meant to ask concerned the mantissa, not the exponent, and has lots to do with the question I asked earlier in the week regarding "missing" digits on the sum of two negative floats. Given that the mantissa has a variable precision, how does one tell if one has overflowed the mantissa's current precision setting? Or, from ...

How to find mantissa length on a particular machine?

I'm wanting to find the number of mantissa digits and the unit round-off on a particular computer. I have an understanding of what these are, just no idea how to find them - though I understand they can vary from computer to computer. I need this number in order to perform certain aspects of numerical analysis, like analyzing errors. ...

How do ldexp and frexp work in python?

The python frexp and ldexp functions splits floats into mantissa and exponent. Do anybody know if this process exposes the actual float structure, or if it requires python to do expensive logarithmic calls? ...

Cocoa: NSDecimalNumber with mantissa and exponent of 0

Mathematically any number with an exponent of 0 is supposed to equal 1 (my remedial math research assures me). But this code produces 5: [NSDecimalNumber decimalNumberWithMantissa:5 exponent:0 isNegative:NO] Is this something standard in computer programming -- that can be relied upon not being "corrected" in future Cocoa versions? ...

Floating point mantissa bias

Does anybody know how to go out solving this problem? * a = 1.0 × 2^9 * b = −1.0 × 2^9 * c = 1.0 × 2^1 Using the floating-point (the representation uses a 14-bit format, 5 bits for the exponent with a bias of 16, a normalized mantissa of 8 bits, and a single sign bit for the number), perform the following two calculations, paying clo...

GCC Handling Float comparison differently at different Optimization Levels

I have some simple code that is comparing two float values to illustrate a problem I see with GCC's optimization and am hoping someone can help me figure out why the output it produces is different under some repeatable circumstances. First, I know it's bad to compare float values with == because you can be off by some very small amou...

Packing 32bit floats into 30 bits (c++)

Hi all. Here are the goals I'm trying to achieve: I need to pack 32 bit IEEE floats into 30 bits. I want to do this by decreasing the size of mantissa by 2 bits. The operation itself should be as fast as possible. I'm aware that some precision will be lost, and this is acceptable. It would be an advantage, if this operation would not r...

vb.net mantissa and exponent calculation from double

Hi there. Can anyone offer any advice on how to get the mantissa and exponent from a double in VB.net? I know I can do a string parse and some conversion to ints but I wondered if anyone had a mathematical equivalent formula that would allow me to do this? Many thanks ...