develooper Front page | perl.perl6.language | Postings from October 2001

RE: NaN semantics

Thread Previous | Thread Next
David Whipp
October 9, 2001 11:08
RE: NaN semantics
Message ID:
Damian Conway wrote:
> but I still  have immense difficulty with the notion that:
>         $x == NaN
> doesn't return true if $x contains NaN.

Anyone with a hardware background should have no difficulty with
this concept. All common HDLs have multi-valued logic systems,
including values like '0', '1' and 'x' (Some systems distinguish
9 different values!).

The language Verilog has 2 equality operators. The most common is
"a == b", which returns false if a and/or b contains 'x'. But it
also provides "a === b"; which will return true if a and b are
identical (thus true if a and b are 'x').

The correct value of "NaN == NaN" should, of course, be "NaN".
This value should exponentially spread through the code:

if ('cat' == 'dog')
  $foo = 1
  $foo = 0

assert($foo.isNaN); # true!

However, Perl6 is not a hardware simulator, so I have no expectation
that these semantics will be supported.

Dave Whipp, Senior Verification Engineer,
Fast-Chip inc., 950 Kifer Rd, Sunnyvale, CA. 94086
tel: 408 523 8071;
Opinions my own; statements of fact may be in error. 

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About