Front page | perl.perl6.language |
Postings from October 2001
Re: NaN semantics
Thread Previous
|
Thread Next
From:
Damian Conway
Date:
October 7, 2001 01:27
Subject:
Re: NaN semantics
Message ID:
200110070827.SAA51004@indy05.csse.monash.edu.au
> Semantic confusion alert!
Aroogha! Aroogha! All crew to clarification stations!
> EX3 (great document!)
Thank-you.
> sez:
>
> > 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?
> The example can be rewritten
>
> print "Inflation rate: " and $inflation = +<>
> while $inflation != $inflation;
Err. No it can't.
> That is ugly, non-intuitive and ugly; and non-intuitive too. But
> inconsistency with a long accepted standard is also ungood. Perhaps we
> need to write it thus:
>
> print "Inflation rate: " and $inflation = +<>
> while $inflation.isnan;
>
> or some such?
Or:
print "Inflation rate: " and $inflation = +<>
while $inflation == NaN;
which is:
print "Inflation rate: " and $inflation = +<>
while !($inflation != NaN);
which is:
print "Inflation rate: " and $inflation = +<>
until ($inflation != NaN);
which is exactly what I wrote.
;-)
Damian
Thread Previous
|
Thread Next