hi steven:
yes it does help, because I now know that I need BigFloat, but the perl
default treatment still seems like a big. if NaN is the IEEE quantity
(or something similar), then $x should be NaN. if NaN is just a
string, then perl should give an error at the addition, just as it
would if the string were NA.
regards,
/iaw
Yes, if you're unfamiliar with
Perl internals, then the above
does seem confusing.
A scalar in Perl can be a string,
a number, or a string and a
number at the same time.
One can use the Devel:

eek module
to look at the underlying structure
of a scalar (as it's "upgraded"
as the program advances).
Here's an example:
use strict;
use warnings;
use Devel:

eek;
my $v = "NA";
Dump $v;
my $x = $v + 1.0; # warning expected
Dump $v;
$v = "NAN";
Dump $v;
$x = $v + 1.0; # no warning here!
Dump $v;
== The results (and my comments) ==
SV = PV(0xf5870) at 0xffb98
REFCNT = 1
FLAGS = (PADBUSY,PADMY,POK,pPOK)
PV = 0xfbef0 "NA"\0
CUR = 2
LEN = 3
:: At this point $v is a string,
the scalar is a PV, and PV has
the value "NA". Thus we
see the following warning upon
attempted addition:
Argument "NA" isn't numeric in addition (+) at explain.pl line 11.
SV = PVNV(0x137a50) at 0xffb98
REFCNT = 1
FLAGS = (PADBUSY,PADMY,IOK,NOK,POK,pIOK,pNOK,pPOK)
IV = 0
NV = 0
PV = 0xfbef0 "NA"\0
CUR = 2
LEN = 3
:: The attempt at addition, however,
causes the scalar to be upgraded to
a PVNV. Now the scalar has not
only the string representation,
"NA", but also numeric representations
in the NV and IV slots.
SV = PVNV(0x137a50) at 0xffb98
REFCNT = 1
FLAGS = (PADBUSY,PADMY,POK,pPOK)
IV = 0
NV = 0
PV = 0xfbef0 "NAN"\0
CUR = 3
LEN = 4
:: We reassign to the PV slot of
the scalar, replacing "NA" with "NAN".
The second attempt at addition, however,
produces no warnings.
SV = PVNV(0x137a50) at 0xffb98
REFCNT = 1
FLAGS = (PADBUSY,PADMY,IOK,NOK,POK,pIOK,pNOK,pPOK)
IV = 0
NV = 0
PV = 0xfbef0 "NAN"\0
CUR = 3
LEN = 4
:: That because, the addition operation
is using the value in the NV slot
of the scalar -- which was initialized
to zero. 0 + 1.0 is 1.0; no warnings
because perl was trying to DWYM
(Do What You Meant).