CORBA::ORBit::Fixed - Fixed point arithmetic for CORBA.
use CORBA:::ORBit::Fixed; $a = new CORBA::Fixed "+123454", 3 print $a + 1.0 # produces "+124.454"
CORBA::ORBit::Fixed implements arithmetic operations on fixed point numbers. It is meant to be used in conjuction with the CORBA::ORBit module, but could conceivable be useful otherwise. Note that the file is called CORBA::ORBit::Fixed, but it implements the generic package CORBA::Fixed.
CORBA::ORBit::Fixed
CORBA::Fixed
Internally, numbers are as represented as a pair of a Math::BigInt multiple precision integer, and a integer scale. (positive or negative).
Math::BigInt
Addition, subtraction, and multiplication are carried out precisely. For adddition and subtraction, of two numbers with scales s1 and s2, the resulting scale is MAX(s1,s2). For multiplication the resulting scale is s1+s2.
s1
s2
MAX(s1,s2)
s1+s2
Division is carried out to 31 decimals places, with additional digits truncated without rounding.
Aside from overloaded +, -, *, / <=> and "" operations, CORBA::ORBit::Fixed provides the following methods:
+
-
*
/
<=
""
new STRING SCALE
Given a string (as suitable for input to Math::BigInt), and a scale, create a fixed-point value with the digits and sign of STRING, and the scale SCALE.
from_string STRING
Create a CORBA::Fixed object from a string according to the rules in the CORBA manual for fixed literals. That is, the scale is given by the number of digits to the right of the decimal point, ignoring trailing zeros. If the number has no non-zero digits to the right of the decimal point, the scale will be the negative of the number of trailing zeros to the left of the decimal point.
to_digits ( NDIGITS, SCALE )
Gives the digits (with a leading + or - sign) of the the object's value, rounded to the SCALE, and padded to NDIGITS.
Owen Taylor <otaylor@gtk.org>
perl(1).
1 POD Error
The following errors were encountered while parsing the POD:
You can't have =items (as at line 257) unless the first thing after the =over is an =item
To install CORBA::ORBit, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CORBA::ORBit
CPAN shell
perl -MCPAN -e shell install CORBA::ORBit
For more information on module installation, please visit the detailed CPAN module installation guide.