From 84adefa331c4159d432d22840663c38f155cd4c1 Mon Sep 17 00:00:00 2001 From: Erlang/OTP Date: Fri, 20 Nov 2009 14:54:40 +0000 Subject: The R13B03 release. --- lib/orber/doc/src/fixed.xml | 160 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 lib/orber/doc/src/fixed.xml (limited to 'lib/orber/doc/src/fixed.xml') diff --git a/lib/orber/doc/src/fixed.xml b/lib/orber/doc/src/fixed.xml new file mode 100644 index 0000000000..7c59071b49 --- /dev/null +++ b/lib/orber/doc/src/fixed.xml @@ -0,0 +1,160 @@ + + + + +
+ + 2002 + 2007 + Ericsson AB, All Rights Reserved + + + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + + + fixed + + + + + + 2002-05-22 + A +
+ fixed + the corba fixed type + +

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:

+ + Digits - integer(), -1 > Digits < 32 + Scale - integer(), -1 > Scale =< Digits + Value - integer(), range (31 digits): ±9999999999999999999999999999999 + +

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:

+ + fixed<5,3> eq. 03.140d eq. 3140 + fixed<3,2> eq. 3.14d eq. 314 + +

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:

+ + Fixed1 + Fixed2 - ]]> + Fixed1 - Fixed2 - ]]> + Fixed1 * Fixed2 - ]]> + Fixed1 / Fixed2 - ]]> + +

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

+
+ + + create(Digits, Scale, Value) -> Result + Create a fixed type + + 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 + Create TypeCode representing the supplied fixed type + + 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 + Add the supplied Fixed 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 + Subtract Fixed2 from Fixed1 + + 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 + Multiply Fixed1 with Fixed2 + + 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 + Divide Fixed1 with Fixed2 + + 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 + Negate the supplied Fixed Type + + Result = -Fixed | {'EXCEPTION', #'BAD_PARAM'{}} + + +

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

+
+
+
+ +
+ -- cgit v1.2.3