S
santosh
Dom said:Thanks for the input, everyone. It's not quite what I was looking for,
so perhaps I can restate the problem.
I need to export floating-point data from system A to system B. To do
this, I need to know the characteristics of the data format on system
A; in particular, I need to know if it conforms to IEC60559, and which
IEC60559 type it is. I would have exactly the same problem if I needed
to do bit manipulation of the FP data.
The problem is that C (or, to be more precise, the compiler in
combination with libc) exposes 3 FP types, which may be a subset, or a
superset, or even unrelated to the FP support from the underlying
hardware. 'sizeof' gives me no useful information about the 3 exposed
types.
No, but float.h gives you compile time access to a lot of constants. You
can test these constants and appropriately declare typedefs for your
own floating types. All conforming implementations are guaranteed to
support the range 1e-37 -> 1e37 for float, double and long double.
I don't think your problem (moving floating values from one system to
another) requires you to know the number of bits in the floating point
types. I think conditional compiling with the values in float.h should
be enough to declare types appropriately to move the data, as long as
the destination system has at least one floating type that can hold the
largest value possible in the source system.
<snip>