Damian Conway said: > > > print "Inflation rate: " and $inflation = +<> > > > until $inflation != NaN; > > > > This requires that C<NaN != NaN> be false, causing the loop to continue > > until a valid numeric string is entered.
> Err. Are you *sure*? That's an C<until>, not a C<while>, you realize? Yes. I had to use all my fingers and toes to keep everything straight, but I think I did. :-) In the semantics you show (different from IEEE semantics) "NaN==NaN" is true, so "NaN!=NaN" is false, which is why the loop continues until a valid number is entered. > >The example can be rewritten > > > > print "Inflation rate: " and $inflation = +<> > > while $inflation != $inflation; > Err. No it can't. I meant, if we used IEEE semantics rather than those you showed, the example could be correctly written as ... And did I mention it's ugly this way? Brent Dax said: > His point was that the NaN IEEE came up with is defined to have NaN != > NaN, and that it might be confusing if Perl's behavior wasn't consistent > with that. Not that I think NaN != NaN is a particularly good idea, but > consistency with other languages may be. If NaN != NaN, then his > example is correct. Thank you Brent. Brevity and clarity; what concepts! I must try them sometime. -- Tim Conrow