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

Bug#595782: gcc-4.4: wrong conversion from unsigned int to float on sparc



Package: gcc-4.4
Version: 4.4.4-11
Severity: normal

Hello,

The present bugreport is a followup to #593193 and a regression wrt
4.3.

Steps to reproduce:

    (sid)smetana:~/gcc-4.4/gmp-ecm-6.3$ cat bug.c
    #include <stdio.h>

    int
    main()
    {
      unsigned int t = 254733465;
      float f;
      f = (float) t;
      printf ("t=%u f=%.0f\n", t, f);
    }

    (sid)smetana:~/gcc-4.4/gmp-ecm-6.3$ gcc-4.4 bug.c; ./a.out
    t=254733465 f=482062944

    (sid)smetana:~/gcc-4.4/gmp-ecm-6.3$ gcc-4.3 bug.c; ./a.out
    t=254733465 f=254733472

The correct result is the second one, since the closest single precision
float (24-bit significand) from 254733465 is 254733472.

Many thanks to Lucas Nussbaum and Paul Zimmermann for working on this
bug.

Regards,

Laurent Fousse.



Reply to: