Path: utzoo!attcan!uunet!kddlab!trl!rdmei!ptimtc!olivea!apple!snorkelwacker.mit.edu!ai-lab!rice-chex!bson From: bson@rice-chex.ai.mit.edu (Jan Brittenson) Newsgroups: comp.lang.c Subject: double-precision dissection Message-ID: <12131@life.ai.mit.edu> Date: 30 Nov 90 22:31:11 GMT Sender: news@ai.mit.edu Organization: nil Lines: 23 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 -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. Brought to you by Super Global Mega Corp .com