fixed.3erl man page

fixed ā€” the corba fixed type

Description

This module contains functions that gives an interface to the CORBA fixed type.

The type Fixed used below is defined as:

-record(fixed, {digits, scale, value}).

where digits is the total amount of digits it consists of and scale is the number of fractional digits. The value field contains the actual Fixed value represented as an integer. The limitations of each field are:

Since the Value part is represented by an integer, it is vital that the Digits and Scale values are correct. This also means that trailing zeros cannot be left out in some cases:

Leading zeros can be left out.

For your convenience, this module exports functions which handle unary (-) and binary (+-*/) operations legal for the Fixed type. Since a unary + have no effect, this module do not export such a function. Any of the binary operations may cause an overflow (i.e. more than 31 significant digits; leading and trailing zeros are not considered significant). If this is the case, the Digit and Scale values are adjusted and the Value truncated (no rounding performed). This behavior is compliant with the OMG CORBA specification. Each binary operation have the following upper bounds:

A quotient may have an arbitrary number of decimal places, which is denoted by a scale of Sinf.

Exports

create(Digits, Scale, Value) -> Result

Types:

Result = Fixed Type | {'EXCEPTION', #'BAD_PARAM'{}}

This function creates a new instance of a Fixed Type. If the limitations is not fulfilled (e.g. overflow) an exception is raised.

get_typecode(Fixed) -> Result

Types:

Result = TypeCode | {'EXCEPTION', #'BAD_PARAM'{}}

Returns the TypeCode which represents the supplied Fixed type. If the parameter is not of the correct type, an exception is raised.

add(Fixed1, Fixed2) -> Result

Types:

Result = Fixed1 + Fixed2 | {'EXCEPTION', #'BAD_PARAM'{}}

Performs a Fixed type addition. If the parameters are not of the correct type, an exception is raised.

subtract(Fixed1, Fixed2) -> Result

Types:

Result = Fixed1 - Fixed2 | {'EXCEPTION', #'BAD_PARAM'{}}

Performs a Fixed type subtraction. If the parameters are not of the correct type, an exception is raised.

multiply(Fixed1, Fixed2) -> Result

Types:

Result = Fixed1 * Fixed2 | {'EXCEPTION', #'BAD_PARAM'{}}

Performs a Fixed type multiplication. If the parameters are not of the correct type, an exception is raised.

divide(Fixed1, Fixed2) -> Result

Types:

Result = Fixed1 / Fixed2 | {'EXCEPTION', #'BAD_PARAM'{}}

Performs a Fixed type division. If the parameters are not of the correct type, an exception is raised.

unary_minus(Fixed) -> Result

Types:

Result = -Fixed | {'EXCEPTION', #'BAD_PARAM'{}}

Negates the supplied Fixed type. If the parameter is not of the correct type, an exception is raised.

Referenced By

ex12bit(3), ex3buf(3), ex3d(3), excustom(3), exfixed(3), exrotscl(3), exspline(3), exsprite(3), exstars(3), exupdate(3).

orber 4.5.2 Ericsson AB Erlang Module Definition