GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
JE::Number(3) User Contributed Perl Documentation JE::Number(3)

JE::Number - JavaScript number value

  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

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. It seems that whether Perl numbers are in accord with the IEEE 754 standard that ECMAScript uses is system-dependent. If anyone requires IEEE 754 compliancy, a patch would be welcome. :-)

The "new" method accepts a global (JE) object and a number as its two arguments. If the latter is an object with a "to_number" method whose return value isa JE::Number, that object's internal value will be used. Otherwise the arg itself is used. (The precise details of the behaviour of "new" when the second arg is a object are subject to change.) It is numified 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.

Stringification and boolification are overloaded and produce the same results as in JavaScript

The "typeof" and "class" methods produce the strings 'number' and 'Number', respectively.

JE
JE::Types
JE::Object::Number
2014-10-20 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.