Xref: news2.mv.net comp.os.msdos.djgpp:823 From: Broeker AT axp04 DOT physik DOT rwth-aachen DOT de (Hans-Bernhard Broeker) Newsgroups: comp.os.msdos.djgpp Subject: Re: binary representation of floats Date: 6 Feb 96 11:36:32 GMT Organization: RWTH -Aachen / Rechnerbetrieb Informatik Lines: 30 Message-ID: References: <20E61D84C99 AT dwaf-hri DOT pwv DOT gov DOT za> NNTP-Posting-Host: axp04.physik.rwth-aachen.de To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp "John Carter" writes: >Greetings, >>What I want to do is to get the binary representation of a float >>or double (the way these numbers are stored in memory). >As far as I know, GCC can't store extended precision numbers. (How >about a "long double" type folks?) No need to worry: it's there. The only problem people seem to have with it is that there are almost no library functions that can deal with it. Unless that changed very recently, not even printf() and scanf() can write/read long doubles. But you can do the 4 basic calculations with long doubles, and a little bit of asm could easily add the usual set of other standard functions as well, i.e. log, exp, pow, sin, cos, tan, ....., as these are calculated in long double anyhow, you just have to change the load/store operations to take/give long doubles. >GCC does have a nice long long int, which as seems to be a software >emulated 64 bit int. I don't think this uses the intel FPU 64 bit long >int, but I'm open for correction on that one. Maybe a wee bit of >disassembly will tell us. Might be a good idea, or a bad one. This depends on what operations you want implemented: to my knowledge, the FPU can't do bitshifts on 64bitters, so that would have to be done by emulation, e.g. Hans-Bernhard Broeker