DB Link
API Reference Guide
Product Documentation:

Visualization DB Link
Documentation Home
List of all members | Public Member Functions
IlNumeric Class Reference

Class managing large numbers. More...

#include <ilog/ilnum.h>

Inheritance diagram for IlNumeric:
IldNumeric

Public Member Functions

 IlNumeric ()
 Builds an IlNumeric instance. More...
 
 IlNumeric (const char *value)
 Builds an IlNumeric instance and initializes it. More...
 
 IlNumeric (long value)
 Builds an IlNumeric instance an initializes it. More...
 
IlNumeric abs () const
 
void get (char *buffer, IlInt len) const
 
IlShort getPrecision () const
 
IlShort getScale () const
 
IlBoolean isInteger () const
 
IlBoolean isNegative () const
 
IlBoolean isReal () const
 
void negate ()
 
 operator double () const
 
 operator long () const
 
IlNumeric operator* (const IlNumeric &)
 
IlNumeric operator+ (const IlNumeric &)
 
IlNumeric operator+ (long)
 
IlNumeric operator- (const IlNumeric &)
 
IlBoolean operator< (const IlNumeric &n) const
 
IlBoolean operator<= (const IlNumeric &n) const
 
IlBoolean operator== (const IlNumeric &n) const
 
IlBoolean operator> (const IlNumeric &n) const
 
IlBoolean operator>= (const IlNumeric &n) const
 
IlBoolean set (const char *value)
 
IlBoolean set (long value)
 
IlNumericsetScale (IlShort scale)
 

Detailed Description

Class managing large numbers.

Library: ilog

This class provides data members, member functions, and operators to manage large numbers as objects. The constant IL_MAX_NUM_LEN defines the maximum number of digits for the numbers that are handled by this class.

Constructor & Destructor Documentation

◆ IlNumeric() [1/3]

IlNumeric::IlNumeric ( )

Builds an IlNumeric instance.

This constructor creates and returns an instance of IlNumeric and initializes it to the value 0 (zero).

◆ IlNumeric() [2/3]

IlNumeric::IlNumeric ( const char *  value)

Builds an IlNumeric instance and initializes it.

This constructor creates and returns an instance of IlNumeric and initializes it with the contents of value. This value must conform to the format: [-|+]{digit}*[.[{digit}*]] | [-|+]{digit}+[.[{digit}*]][{E|e} [-|+]{digit}+]" The input string size is limited by the maximum length IL_MAX_NUM_LEN.

Parameters
valueA const reference to a char*.

◆ IlNumeric() [3/3]

IlNumeric::IlNumeric ( long  value)

Builds an IlNumeric instance an initializes it.

This constructor creates and returns an instance of IlNumeric and initializes it with the number contained in value.

Parameters
valueA long.

Member Function Documentation

◆ abs()

IlNumeric IlNumeric::abs ( ) const

Returns the absolute value of the number as a new IlNumeric object.

◆ get()

void IlNumeric::get ( char *  buffer,
IlInt  len 
) const

Returns the value of the invoking instance of IlNumeric in buffer as a string of maximum length len. The format is the same as for the input.

◆ getPrecision()

IlShort IlNumeric::getPrecision ( ) const

Returns the count of digits that make up the number represented by the object.

◆ getScale()

IlShort IlNumeric::getScale ( ) const

Returns the count of digits that make up the fractional part of the number.

◆ isInteger()

IlBoolean IlNumeric::isInteger ( ) const

Returns IlTrue if the numeric representation of the number fits in an integer type variable, or IlFalse otherwise.

◆ isNegative()

IlBoolean IlNumeric::isNegative ( ) const

Specifies whether the number is negative or not.

◆ isReal()

IlBoolean IlNumeric::isReal ( ) const

Returns IlTrue if the numeric representation of the number needs a floating point variable, or IlFalse otherwise.

◆ negate()

void IlNumeric::negate ( )

Changes the sign of the number.

◆ operator double()

IlNumeric::operator double ( ) const

This coercer returns the floating-point value of the invoking instance of IlNumeric.

◆ operator long()

IlNumeric::operator long ( ) const

This coercer returns the integer value of the invoking instance of IlNumeric.

◆ operator*()

IlNumeric IlNumeric::operator* ( const IlNumeric )

This operator returns a new IlNumeric object equal to the product of the invoking instance and the argument.

◆ operator+() [1/2]

IlNumeric IlNumeric::operator+ ( const IlNumeric )

This operator returns a new IlNumeric object representing the sum of the invoking instance and the argument.

◆ operator+() [2/2]

IlNumeric IlNumeric::operator+ ( long  )

This operator returns a new IlNumeric object representing the sum of the invoking instance and the argument.

◆ operator-()

IlNumeric IlNumeric::operator- ( const IlNumeric )

This operator returns a new IlNumeric object equal to the difference between the invoking instance and the argument.

◆ operator<()

IlBoolean IlNumeric::operator< ( const IlNumeric n) const

This predicate indicates whether the invoking instance is less than the argument.

◆ operator<=()

IlBoolean IlNumeric::operator<= ( const IlNumeric n) const

This predicate indicates whether the invoking instance is less than or equal to the argument.

◆ operator==()

IlBoolean IlNumeric::operator== ( const IlNumeric n) const

This predicate indicates whether two instances of IlNumeric are equal.

◆ operator>()

IlBoolean IlNumeric::operator> ( const IlNumeric n) const

This predicate indicates whether the invoking instance is strictly greater than the argument.

◆ operator>=()

IlBoolean IlNumeric::operator>= ( const IlNumeric n) const

This predicate indicates whether the invoking instance is greater than or equal to the argument.

◆ set() [1/2]

IlBoolean IlNumeric::set ( const char *  value)

Assigns value as the value of the invoking instance of IlNumeric. The input string must conform to the same format as the one given in the constructor.

◆ set() [2/2]

IlBoolean IlNumeric::set ( long  value)

Assigns value as the value of the invoking instance of IlNumeric.

◆ setScale()

IlNumeric& IlNumeric::setScale ( IlShort  scale)

Changes the count of digits that make up the fractional part of the number.