# class Number | Handle for a Number type. More...
Full name | `KJS::Number`
Definition | `#include <types.h>`
Inherits | KJS::KJSO [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- Number (int i)
- Number (unsigned int u)
- Number (double d = 0.0)
- Number (long int l)
- Number (long unsigned int l)
- virtual ~Number ()
- double value () const
- int intValue () const
- bool isNaN () const
- bool isInf () const

## Detailed Description

Number is a handle for a number value. KJSO::toPrimitive(), KJSO::toBoolean(), KJSO::toNumber(), KJSO::toString() and KJSO::toString() are re-implemented internally according to the specification.

Example usage:

     Number a(2), b(3.0), c; // c defaults to 0.0

     c = a.value() * b.value(); // c will be 6.0 now

     String s = c.toString(); // s holds "6"

Note the following implementation detail: Internally, the value is stored as a double and will be casted from and to other types when needed. This won't be noticable within a certain range of values but might produce unpredictable results when crossing these limits. In case this turns out to be a real problem for an application we might have to extend this class to behave more intelligently.

Number (int i) | ### Number

Construct a Number type from an integer.

Number (unsigned int u) | ### Number

Construct a Number type from an unsigned integer.

Number (double d = 0.0) | ### Number

Construct a Number type from a double.

Number (long int l) | ### Number

Construct a Number type from a long int.

Number (long unsigned int l) | ### Number

Construct a Number type from a long unsigned int.

~Number () | ### ~Number

[virtual]

Destructor.

double value () | ### value

[const]

Returns: The internally stored value.

int intValue () | ### intValue

[const]

Convenience function.

Returns: The internally stored value converted to an int.

bool isNaN () | ### isNaN

[const]

Returns: True is this is not a number (NaN).

bool isInf () | ### isInf

[const]

Returns: True if Number is either +Infinity or -Infinity.

Generated by: root@i386.ports.openbsd.org on Wed Apr 25 13:58:56 2001, using kdoc 2.0a53.