#include <u.h>
#include <libc.h>

void
main(void)
{
        double g = 4215866817.;

        print("%d\n", (unsigned int)g);
        print("%d\n", (unsigned int)g);
        exits("");
}
8c r.c
8l r.8
./8.out
-79100479
-79100479

no trap. it generates different code.
(obviously the %d should be %ud in this case, giving

doppio% 8.out
4215866817
4215866817

which looks like the right answer

the cast must be to an unsigned integer.
otherwise the resulting range is signed,
and that's more limited

Reply via email to