.TH fixed 3erl "orber 3.8.2" "Ericsson AB" "Erlang Module Definition" .SH NAME fixed \- the corba fixed type .SH DESCRIPTION .LP This module contains functions that gives an interface to the CORBA fixed type\&. .LP The type \fIFixed\fR\& used below is defined as: .LP .nf -record(fixed, {digits, scale, value}). .fi .LP where \fIdigits\fR\& is the total amount of digits it consists of and \fIscale\fR\& is the number of fractional digits\&. The \fIvalue\fR\& field contains the actual Fixed value represented as an integer\&. The limitations of each field are: .RS 2 .TP 2 * Digits - integer(), -1 > Digits < 32 .LP .TP 2 * Scale - integer(), -1 > Scale =< Digits .LP .TP 2 * Value - integer(), range (31 digits): +/-9999999999999999999999999999999 .LP .RE .LP 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: .RS 2 .TP 2 * fixed<5,3> eq\&. 03\&.140d eq\&. 3140 .LP .TP 2 * fixed<3,2> eq\&. 3\&.14d eq\&. 314 .LP .RE .LP Leading zeros can be left out\&. .LP For your convenience, this module exports functions which handle unary (\fI-\fR\&) and binary (\fI+-*/\fR\&) operations legal for the Fixed type\&. Since a unary \fI+\fR\& 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: .RS 2 .TP 2 * \fIFixed1 + Fixed2\fR\& - \fIfixed\fR\& .LP .TP 2 * \fIFixed1 - Fixed2\fR\& - \fIfixed\fR\& .LP .TP 2 * \fIFixed1 * Fixed2\fR\& - \fIfixed\fR\& .LP .TP 2 * \fIFixed1 / Fixed2\fR\& - \fIfixed<(d1-s1+s2) + Sinf ,Sinf >\fR\& .LP .RE .LP A quotient may have an arbitrary number of decimal places, which is denoted by a scale of Sinf\&. .SH EXPORTS .LP .B create(Digits, Scale, Value) -> Result .br .RS .LP Types: .RS 3 Result = Fixed Type | {\&'EXCEPTION\&', #\&'BAD_PARAM\&'{}} .br .RE .RE .RS .LP This function creates a new instance of a \fIFixed Type\fR\&\&. If the limitations is not fulfilled (e\&.g\&. overflow) an exception is raised\&. .RE .LP .B get_typecode(Fixed) -> Result .br .RS .LP Types: .RS 3 Result = TypeCode | {\&'EXCEPTION\&', #\&'BAD_PARAM\&'{}} .br .RE .RE .RS .LP Returns the TypeCode which represents the supplied Fixed type\&. If the parameter is not of the correct type, an exception is raised\&. .RE .LP .B add(Fixed1, Fixed2) -> Result .br .RS .LP Types: .RS 3 Result = Fixed1 + Fixed2 | {\&'EXCEPTION\&', #\&'BAD_PARAM\&'{}} .br .RE .RE .RS .LP Performs a Fixed type addition\&. If the parameters are not of the correct type, an exception is raised\&. .RE .LP .B subtract(Fixed1, Fixed2) -> Result .br .RS .LP Types: .RS 3 Result = Fixed1 - Fixed2 | {\&'EXCEPTION\&', #\&'BAD_PARAM\&'{}} .br .RE .RE .RS .LP Performs a Fixed type subtraction\&. If the parameters are not of the correct type, an exception is raised\&. .RE .LP .B multiply(Fixed1, Fixed2) -> Result .br .RS .LP Types: .RS 3 Result = Fixed1 * Fixed2 | {\&'EXCEPTION\&', #\&'BAD_PARAM\&'{}} .br .RE .RE .RS .LP Performs a Fixed type multiplication\&. If the parameters are not of the correct type, an exception is raised\&. .RE .LP .B divide(Fixed1, Fixed2) -> Result .br .RS .LP Types: .RS 3 Result = Fixed1 / Fixed2 | {\&'EXCEPTION\&', #\&'BAD_PARAM\&'{}} .br .RE .RE .RS .LP Performs a Fixed type division\&. If the parameters are not of the correct type, an exception is raised\&. .RE .LP .B unary_minus(Fixed) -> Result .br .RS .LP Types: .RS 3 Result = -Fixed | {\&'EXCEPTION\&', #\&'BAD_PARAM\&'{}} .br .RE .RE .RS .LP Negates the supplied Fixed type\&. If the parameter is not of the correct type, an exception is raised\&. .RE