DL Logo

CosNumber Functions

CosDoubleValue

Header: CosProcs.h:2405

Description

Gets the value of obj as a double-precision floating-point real number.

An exception is raised if the given object has the wrong Cos type.

Syntax

double CosDoubleValue(CosObj obj);

Parameters

obj
The object whose value is obtained. It must have type CosInteger or CosReal ( CosFixed). The result is undefined if the real value is outside the range of floating-point numbers.

Returns

The numeric value of obj, represented as a floating-point number.

CosFixedValue

Header: CosProcs.h:520

Description

Gets the value of obj as a fixed-point real number.

Syntax

ASFixed CosFixedValue(CosObj obj);

Parameters

obj

The object whose value is obtained. It must have type CosInteger or CosReal ( CosFixed). The result is undefined if the real value is outside the range of ASFixed numbers.

An exception is raised if the given object has the wrong Cos type.

Returns

The numeric value of obj, represented as a fixed-point number.

CosFloatValue

Header: CosProcs.h:1907

Description

Gets the value of obj as a single-precision floating-point real number.

An exception is raised if the given object has the wrong Cos type.

Syntax

float CosFloatValue(CosObj obj);

Parameters

obj
The object whose value is obtained. It must have type CosInteger or CosReal ( CosFixed). The result is undefined if the real value is outside the range of floating-point numbers.

Returns

The numeric value of obj, represented as a floating-point number.

CosInteger64Value

Header: CosProcs.h:1871

Description

Gets the 64-bit integer value of a specified number object.

An exception is raised if the given object has the wrong Cos type.

Syntax

ASInt64 CosInteger64Value(CosObj obj);

Parameters

obj
The object whose integer value is obtained. It must have type CosInteger or CosReal ( CosFixed). If it is CosReal, its value is rounded to the nearest integer. The result is undefined if the real value is outside the range of ASInt64 numbers.

Returns

The 64-bit integer value of obj.

CosIntegerValue

Header: CosProcs.h:505

Description

Gets the 32-bit integer value of a specified number object.

Syntax

ASInt32 CosIntegerValue(CosObj obj);

Parameters

obj

The object whose integer value is obtained. It must have type CosInteger or CosReal ( CosFixed). If it is CosReal, its value is rounded to the nearest integer. The result is undefined if the real value is outside the range of ASInt32 numbers.

An exception is raised if the given object has the wrong Cos type.

Returns

The 32-bit integer value of obj.

CosNewDouble

Header: CosProcs.h:2363

Description

Creates a new real-number object from a double-precision floating-point number associated with the specified document.

Syntax

CosObj CosNewDouble(CosDoc dP, ASBool indirect, double value);

Parameters

dP
The document in which the number is used.
indirect
If true, it creates the real-number object as an indirect object, and sets the document dP object's PDDocNeedsSave flag (see PDDocFlags). If false, it creates the number as a direct object.
value
The real number, represented as a double-precision floating-point number.

Returns

A Cos object of type CosReal ( CosFixed).

CosNewDoubleEx

Header: CosProcs.h:2386

Description

Creates a new real-number object from a double-precision floating-point number associated with the specified document.

Syntax

CosObj CosNewDoubleEx(CosDoc dP, ASBool indirect, double value, ASUns8 numSigDigs);

Parameters

dP
The document in which the number is used.
indirect
If true, it creates the real-number object as an indirect object, and sets the document dP object's PDDocNeedsSave flag (see PDDocFlags). If false, it creates the number as a direct object.
value
The real number, represented as a double-precision floating-point number.
value
The maximum number of significant digits to use when this object is written to a file. Legal values are 6-13 for direct objects, 6-16 for indirect objects

Returns

A Cos object of type CosReal ( CosFixed).

CosNewFixed

Header: CosProcs.h:178

Description

Creates a new real-number object from a fixed-point number associated with the specified document.

Syntax

CosObj CosNewFixed(CosDoc dP, ASBool indirect, ASFixed value);

Parameters

dP
The document in which the number is used.
indirect
If true, it creates the real-number object as an indirect object, and sets the document ( dP) object's PDDocNeedsSave flag (see PDDocFlags). If false, it creates the number as a direct object.
value
The real number, represented as a fixed-point number.

Returns

A Cos object of type CosReal ( CosFixed).

CosNewFloat

Header: CosProcs.h:1890

Description

Creates a new real-number object from a single-precision floating-point number associated with the specified document.

Syntax

CosObj CosNewFloat(CosDoc dP, ASBool indirect, float value);

Parameters

dP
The document in which the number is used.
indirect
If true, it creates the real-number object as an indirect object, and sets the document dP object's PDDocNeedsSave flag (see PDDocFlags). If false, it creates the number as a direct object.
value
The real number, represented as a single-precision floating-point number.

Returns

A Cos object of type CosReal ( CosFixed).

CosNewInteger

Header: CosProcs.h:159

Description

Creates a new 32-bit integer object associated with the specified document and having the specified value.

Syntax

CosObj CosNewInteger(CosDoc dP, ASBool indirect, ASInt32 value);

Parameters

dP
IN The document in which the integer is used.
indirect
IN If true, it creates the integer object as an indirect object, and sets the document dP object's PDDocNeedsSave flag (see PDDocFlags). If false, it creates the integer as a direct object.
value
IN The value, represented as a 32-bit integer.

Returns

An object of type CosInteger.

CosNewInteger64

Header: CosProcs.h:1853

Description

Creates a new 64-bit integer object associated with the specified document and having the specified value.

Syntax

CosObj CosNewInteger64(CosDoc dP, ASBool indirect, ASInt64 value);

Parameters

dP
IN The document in which the integer is used.
indirect
IN If true, it creates the integer object as an indirect object, and sets the document dP object's PDDocNeedsSave flag (see PDDocFlags). If false, it creates the integer as a direct object.
value
IN The value, represented as a 64-bit integer.

Returns

An object of type CosInteger.

CosNumberIsWithinASFixedRange

Header: CosProcs.h:2245

Description

Tests whether the value of a Cos number is inside the range of ASFixed numbers, [-32768.0, +32768.0).

If so, the ASFixed value may be obtained by calling CosFixedValue().

If not, the floating-point value may be obtained by calling CosFloatValue().

It raises an exception if obj is not a number ( CosInteger or CosReal).

Syntax

ASBool CosNumberIsWithinASFixedRange(CosObj obj);

Parameters

obj
A Cos integer or real number.

Returns

true if the value of the number is in the range of ASFixed, false otherwise.

CosNumberIsWithinASInt32Range

Header: CosProcs.h:2229

Description

Tests whether the value of a Cos number is inside the range of 32-bit integers, [-2147483648, +2147483647].

If so, the 32-bit value may be obtained by calling CosIntegerValue().

If not, the 64-bit value may be obtained by calling CosIntegerValue64().

It raises an exception if obj is not a number ( CosInteger or CosReal).

Related Methods

Syntax

ASBool CosNumberIsWithinASInt32Range(CosObj obj);

Parameters

obj
A Cos integer or real number.

Returns

true if the value of the number is in the range of 32-bit integers, false otherwise.