Re: [9fans] comparisons with NaN

2013-09-20 Thread Richard Miller
On ARM, it turns out that comparisons with NaN can be made to do the right thing with no code penalty, by a more careful selection of condition code values in the subsequent conditional branch. The meaning of the CC bits in the PSR is subtly different when they've been copied from the floating

Re: [9fans] comparisons with NaN

2013-08-22 Thread Richard Miller
it would be reasonable to try to follow the standard, unless it's stupid, ill-advised, or impossible (or all three). Not impossible, maybe a bit tricky to stop the linkers from reordering things. The cost would be (at least) one extra instruction for each 'if' statement with a floating point

Re: [9fans] comparisons with NaN

2013-08-22 Thread Charles Forsyth
it would be reasonable to try to follow the standard, unless it's stupid, ill-advised, or impossible (or all three). I was a little ambiguous. I meant that statement in general, but I in the particular case of floating-point, being fundamental, probably should work as now defined, and I

[9fans] comparisons with NaN

2013-08-21 Thread Richard Miller
The Plan 9 C compilers do not appear to be compliant with the IEEE floating point standard when making comparisons with NaN (not a number) values. The standard says a comparison with one or both operands NaN is unordered, ie all relations evaluate to false, except != which is always true.

Re: [9fans] comparisons with NaN

2013-08-21 Thread erik quanstrom
amd64 does yet something else. amd64 (a == b) (a = b) (a b) (b == a) (b = a) (b a) 386 (a b) (a = b) (a == b) (b a) (b = a) (b == a) arm (a b) (a = b) (a != b) (b a) (b = a) (b != a) mips(a b) (a = b) (a != b) (b a) (b = a) (b != a) mainly the assumption, in the compiler

Re: [9fans] comparisons with NaN

2013-08-21 Thread erik quanstrom
how about another option, just a bug. what i mean is, the need for fixing it depends on how much havoc this issue causes. - erik

Re: [9fans] comparisons with NaN

2013-08-21 Thread Richard Miller
at least in terms of passing floating point test suites (like python's) the NaN issue doesn't come up Actually it was a test suite that revealed the NaN errors. I wouldn't think it's something anyone needs in normal day-to-day computation, but sometimes boxes must be ticked.

Re: [9fans] comparisons with NaN

2013-08-21 Thread erik quanstrom
On Wed Aug 21 12:09:26 EDT 2013, 9f...@hamnavoe.com wrote: at least in terms of passing floating point test suites (like python's) the NaN issue doesn't come up Actually it was a test suite that revealed the NaN errors. I wouldn't think it's something anyone needs in normal day-to-day

Re: [9fans] comparisons with NaN

2013-08-21 Thread Bakul Shah
On Aug 21, 2013, at 9:55 AM, erik quanstrom quans...@quanstro.net wrote: On Wed Aug 21 12:09:26 EDT 2013, 9f...@hamnavoe.com wrote: at least in terms of passing floating point test suites (like python's) the NaN issue doesn't come up Actually it was a test suite that revealed the NaN

Re: [9fans] comparisons with NaN

2013-08-21 Thread erik quanstrom
On Wed Aug 21 13:43:54 EDT 2013, ba...@bitblocks.com wrote: On Aug 21, 2013, at 9:55 AM, erik quanstrom quans...@quanstro.net wrote: On Wed Aug 21 12:09:26 EDT 2013, 9f...@hamnavoe.com wrote: at least in terms of passing floating point test suites (like python's) the NaN issue doesn't

Re: [9fans] comparisons with NaN

2013-08-21 Thread Bakul Shah
On Wed Aug 21 13:43:54 EDT 2013, ba...@bitblocks.com wrote: On Aug 21, 2013, at 9:55 AM, erik quanstrom quans...@quanstro.net wrote: On Wed Aug 21 12:09:26 EDT 2013, 9f...@hamnavoe.com wrote: Actually it was a test suite that revealed the NaN errors. I wouldn't think it's something anyone

Re: [9fans] comparisons with NaN

2013-08-21 Thread Richard Miller
by this i ment to refer to -0. But the subject line says comparisons with NaN. Start another thread about signed zero if you like. (I'm not facing a test suite objecting to those at the moment.)

Re: [9fans] comparisons with NaN

2013-08-21 Thread lucio
what i mean is, the need for fixing it depends on how much havoc this issue causes. Well, there is also the question of whether anything at all will break if the bug is fixed. If not, then the answer is simple. ++L

Re: [9fans] comparisons with NaN

2013-08-21 Thread Charles Forsyth
I think that if there is a generally-accepted standard for the behaviour of a language's handling of floating-point numbers, it would be reasonable to try to follow the standard, unless it's stupid, ill-advised, or impossible (or all three). That reply to the Stack Overflow post -- and this might

Re: [9fans] comparisons with NaN

2013-08-21 Thread erik quanstrom
On Wed Aug 21 14:23:48 EDT 2013, lu...@proxima.alt.za wrote: what i mean is, the need for fixing it depends on how much havoc this issue causes. Well, there is also the question of whether anything at all will break if the bug is fixed. If not, then the answer is simple. fortunately,