This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: H8300: converting unsigned int to float
- To: Klaus Pedersen <klaus dot pedersen at nokia dot com>
- Subject: Re: H8300: converting unsigned int to float
- From: Manfred Metzger <ManfredMetzger at gmx dot de>
- Date: Thu, 12 Aug 1999 16:06:21 +0200
- CC: egcs-bugs at egcs dot cygnus dot com
- References: <37AF1D8E.3F6F0591@gmx.de> <37AFF19E.77B1E2E5@nokia.com>
Klaus Pedersen wrote:
> I think that floating point works - at least I haven't had any problems with that.
> Try to compile this example instead:
>
> #include <stdio.h>
> volatile float a;
> unsigned int b = 192;
> main()
> {
> a = b;
> printf("adjk %f skjd\n",a);
> return 0;
> }
>
I have the same problem with your program as with mine.
The compiler generates a number which is too small to fit in
a float. In both cases it's 1.18305218616677471097e-269.
The problem exists with
GNU C version 2.95 19990728 (release) (h8300-hms) compiled by
GNU C version 2.95 19990728 (release).
and
GNU C version egcs-2.93.09 19990221 (gcc2 ss-980929 experimental) (h8300-hms) compiled by
GNU C version egcs-2.91.60 19981201 (egcs-1.1.1 release).
Another problem i have with your program is, that even those
compilers, which can compile Your program generate a.out-files
which print wrong values.
For example
GNU C version gcc-2.95 19990608 (prerelease) (h8300-hms) compiled by
GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release).
and
GNU C version egcs-2.93.18 19990412 (gcc2 ss-980929 experimental) (h8300-hms) compiled by
GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release).
and
GNU C version egcs-2.93.19 19990418 (gcc2 ss-980929 experimental) (h8300-hms) compiled by
GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release).
print
adjk 128.000107 skjd
GNU C version egcs-2.91.60 19981201 (egcs-1.1.1 release) (h8300-hms) compiled by
GNU C version egcs-2.91.60 19981201 (egcs-1.1.1 release).
and
GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release) (h8300-hms) compiled by
GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release).
print
adjk 128.000000 skjd
Regards,
Manni