double-precision dissection
Jan Brittenson
bson at rice-chex.ai.mit.edu
Sat Dec 1 09:31:11 AEST 1990
I'm looking for a fairly portable way of extracting the exponent of
a double, such that:
(int) EXP_OF(1.2345e-17) == -17
Portability is more important than speed. Precision isn't of
importance either, as the mantissa is handled separately. I'm using
SunOS 4.1, and didn't find any clues at all as to how to accomplish
this in the man pages. (I.e. no functions for dissecting doubles.) Use
of pure <math.h>-declared functions/defined would be perfect.
I guess one way would be to set the mantissa to 1 and return the
log10.
My aim is to generate 10's complement BCD-coded floating-point data
in a cross assembler where ease of porting is the main objective.
Doubles don't conform to the range of the BCD numbers, but that's not
a big issue. For simplicity all floating-arithmetic is done in
doubles, and are converted to BCD numbers only when generating data.
More information about the Comp.lang.c
mailing list