This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: H8300: converting unsigned int to float


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]