Re: lrint(INT_MAX) != INT_MAX

2019-08-13 Thread Boudewijn Dijkstra
s than, as in strictly less? Why? Do you mean <= ? My statement is true for both < and <=, but I guess it would have been less confusing if I had written "less then or equal to". > If so, shouldn't lrint(INT_MAX) == INT_MAX = lround(INT_MAX)? If the double type provide

Re: lrint(INT_MAX) != INT_MAX

2019-08-09 Thread Otto Moerbeek
; > > > > 2147483647.00 is -1 > > > 2147483647.00 is -1 > > > > > > That doesn't seem right: isn't INT_MAX representable as a long, > > > even on these machines where sizeof(int) == sizeof(long)? > > > > If it is less than LONG_MAX,

Re: lrint(INT_MAX) != INT_MAX

2019-08-09 Thread Jan Stary
> > l = lround(d); > > printf("%f is %ld\n", d, l); > > > > return 0; > > } > > > > 2147483647.00 is -1 > > 2147483647.00 is -1 > > > > That doesn't seem right: isn't INT_MAX representable as a long, > > e

Re: lrint(INT_MAX) != INT_MAX

2019-07-31 Thread Boudewijn Dijkstra
these machines where sizeof(int) == sizeof(long)? If it is less than LONG_MAX, then yes. If so, shouldn't lrint(INT_MAX) == INT_MAX = lround(INT_MAX)? If the double type provides enough mantisse (which I think it does on all platforms), and if I read a few C standards correctly, then yes.

lrint(INT_MAX) != INT_MAX

2019-07-30 Thread hans
g)? If so, shouldn't lrint(INT_MAX) == INT_MAX = lround(INT_MAX)? On i386 (an ALIX), I see 2147483647.00 is 2147483647 2147483647.00 is -1 so lrint() returns the expected value but lround() does not. On the amd64s I have, I see the expected: 2147483647.00 is 2147483647 2147483647.