NAME
JE::Number - JavaScript number value
SYNOPSIS
use JE;
use JE::Number;
$j = JE->new;
$js_num = new JE::Number $j, 17;
$perl_num = $js_num->value;
$js_num->to_object; # returns a new JE::Object::Number
DESCRIPTION
This class implements JavaScript number values for JE. The difference in use between this and JE::Object::Number is that that module implements number objects, while this module implements the primitive values.
Right now, this module simply uses Perl numbers underneath for storing the JavaScript numbers (except for NaN, +Infinity and -Infinity). I do not know whether Perl numbers are in accord with the IEEE 754 standard that ECMAScript uses. Could someone knowledgeable please inform me?
The new
method accepts a global (JE) object and a Perl scalar as its two arguments. The latter can be a Perl number or a string matching /^( Nan | [+-]?infinity )\z/s
.
The value
method produces a Perl scalar. The 0+
numeric operator is overloaded and produces the same.
To do: Make it use Perl's 'nan' and 'inf' values. When I started writing this, I didn't know that Perl supported these.
SEE ALSO
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 135:
=over without closing =back