[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ale] gcc optimization problem



Joe,

What matters is that values reported as 0.0 by the applications that generate 
my input data are also reported as 0.0 by my applications. That is the case, 
verified with two third party applications. If there is a bug or variation from the 
standard for Vax floating point representation, then the originators of the files 
I need to read must have the same bug or variation.

Thanks,
Alan

> I linked your function with the following:
> 
> #include <stdio.h>
> typedef double Float64;
> Float64 readVaxFloat(Float64 *input);
> unsigned long long int in = 0;
> double * dbl = (double *)&in;
> int main (void) {
>         printf ("Input:  0x%.16llx %.15e\n", in, *dbl);
>         *dbl = readVaxFloat (dbl);
>         printf ("Output: 0x%.16llx %.15e\n", in, *dbl);
>         return 0;
> }
> 
> The result was:
> Input:  0x0000000000000000 0.000000000000000e+00
> Output: 0x37e0000000000000 1.469367938527859e-39
> 
> My understanding is that, on a VAX, 0.0 is represented with all the 
> exponent bits and the sign bit set to 0 (all the other bits in the 
> significand are ignored).  In the IEEE format, 0.0 is represented 
> with all the bits set to zero, except the sign bit may be either 1 or 
> 0.  
> 
> If a value 0.0 (whose bit pattern on a VAX could be represented as 
> 0x0000000000000000) is fed as input to your function, the return bits 
> are 0x37E0000000000000, which in IEEE format, represents 
> 1.469367938527859e-39.  The proper return bit pattern should instead 
> be 0x0000000000000000.  
> 
> The modified function below would correctly handle this.  Of course, 
> it sounds like none of this really matters for your needs.
> 



D. Alan Stewart
Layton Graphics, Inc.
155 Woolco Dr.
Marietta, GA 30062
Voice: 770/973-4312
Fax: 800/367-8192
FTP: ftp.layton-graphics.com
WWW: www.layton-graphics.com


"As far as the laws of mathematics refer to reality, they
are not certain; and as far as they are certain, they do
not refer to reality." - Albert Einstein

---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.