The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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 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. 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 is numerified Perl-style, so 'nancy' becomes NaN and 'information' becomes Infinity.

The value method produces a Perl scalar. The 0+ numeric operator is overloaded and produces the same.

To do: Add support for negative zero, which the specification requires. This makes a difference in very few cases (x/-0 is the only one I can think of). Does anyone actually use this?

SEE ALSO

JE
JE::Types
JE::Object::Number

1 POD Error

The following errors were encountered while parsing the POD:

Around line 190:

=over without closing =back