Erlang -- fixed

User's Guide
Reference Manual
Release Notes
PDF
Top

orber
Reference Manual
Version 3.8.2

Expand All
Contract All

Table of Contents

- any
  - Top of manual page
  - create/0
  - create/2
  - get_typecode/1
  - get_value/1
  - set_typecode/2
  - set_value/2
- fixed
  - Top of manual page
  - add/2
  - create/3
  - divide/2
  - get_typecode/1
  - multiply/2
  - subtract/2
  - unary_minus/1
- corba
  - Top of manual page
  - add_alternate_iiop_address/3
  - add_initial_service/2
  - create/2
  - create/3
  - create/4
  - create_link/2
  - create_link/3
  - create_link/4
  - create_nil_objref/0
  - create_subobject_key/2
  - dispose/1
  - get_pid/1
  - get_subobject_key/1
  - list_initial_services/0
  - list_initial_services_remote/1
  - list_initial_services_remote/2
  - object_to_string/1
  - orb_init/1
  - print_object/1
  - raise/1
  - remove_initial_service/1
  - reply/2
  - resolve_initial_references/1
  - resolve_initial_references/2
  - resolve_initial_references_remote/2
  - resolve_initial_references_remote/3
  - string_to_object/1
  - string_to_object/2
- corba_object
  - Top of manual page
  - get_interface/1
  - hash/2
  - is_a/2
  - is_a/3
  - is_equivalent/2
  - is_nil/1
  - is_remote/1
  - non_existent/1
  - non_existent/2
  - not_existent/1
  - not_existent/2
- orber
  - Top of manual page
  - activate_audit_trail/0
  - activate_audit_trail/1
  - add_listen_interface/2
  - add_listen_interface/3
  - add_listen_interface/3
  - add_node/2
  - close_connection/1
  - close_connection/2
  - configure/2
  - deactivate_audit_trail/0
  - domain/0
  - exception_info/1
  - get_ORBDefaultInitRef/0
  - get_ORBInitRef/0
  - get_tables/0
  - iiop_acl/0
  - iiop_connection_timeout/0
  - iiop_connections/0
  - iiop_connections/1
  - iiop_connections_pending/0
  - iiop_in_connection_timeout/0
  - iiop_out_ports/0
  - iiop_out_ports_attempts/0
  - iiop_out_ports_random/0
  - iiop_port/0
  - iiop_ssl_port/0
  - iiop_timeout/0
  - info/0
  - info/1
  - install/1
  - install/2
  - is_system_exception/1
  - jump_start/1
  - objectkeys_gc_time/0
  - orber_nodes/0
  - remove_listen_interface/1
  - remove_node/1
  - secure/0
  - set_ssl_client_options/1
  - ssl_client_options/0
  - ssl_server_options/0
  - start/0
  - start/1
  - stop/0
  - uninstall/0
- orber_ifr
  - Top of manual page
  - contents/3
  - create_alias/5
  - create_array/3
  - create_attribute/6
  - create_constant/6
  - create_enum/5
  - create_exception/5
  - create_fixed/3
  - create_idltype/2
  - create_interface/5
  - create_module/4
  - create_operation/9
  - create_sequence/3
  - create_string/2
  - create_struct/5
  - create_union/6
  - create_wstring/2
  - describe/1
  - describe_contents/4
  - describe_interface/1
  - destroy/1
  - find_repository/0
  - get_absolute_name/1
  - get_base_interfaces/1
  - get_bound/1
  - get_containing_repository/1
  - get_contexts/1
  - get_def_kind/1
  - get_defined_in/1
  - get_discriminator_type/1
  - get_discriminator_type_def/1
  - get_element_type/1
  - get_element_type_def/1
  - get_exceptions/1
  - get_id/1
  - get_kind/1
  - get_length/1
  - get_members/1
  - get_mode/1
  - get_name/1
  - get_original_type_def/1
  - get_params/1
  - get_primitive/2
  - get_result/1
  - get_result_def/1
  - get_type/1
  - get_type_def/1
  - get_value/1
  - get_version/1
  - init/2
  - is_a/2
  - lookup/2
  - lookup_id/2
  - lookup_name/5
  - move/4
  - set_base_interfaces/2
  - set_bound/2
  - set_contexts/2
  - set_discriminator_type_def/2
  - set_element_type_def/2
  - set_exceptions/2
  - set_id/2
  - set_length/2
  - set_members/2
  - set_mode/2
  - set_name/2
  - set_original_type_def/2
  - set_params/2
  - set_result_def/2
  - set_type_def/2
  - set_value/2
  - set_version/2
- orber_tc
  - Top of manual page
  - alias/3
  - any/0
  - array/2
  - boolean/0
  - char/0
  - check_tc/1
  - double/0
  - enum/3
  - exception/3
  - fixed/2
  - float/0
  - get_tc/1
  - get_tc/1
  - long/0
  - long_long/0
  - null/0
  - object_reference/2
  - octet/0
  - principal/0
  - sequence/2
  - short/0
  - string/1
  - struct/3
  - typecode/0
  - union/5
  - unsigned_long/0
  - unsigned_long_long/0
  - unsigned_short/0
  - void/0
  - wchar/0
  - wstring/1
- orber_acl
  - Top of manual page
  - match/2
  - match/3
  - range/2
  - verify/3
- CosNaming
- CosNaming_NamingContext
  - Top of manual page
  - bind/3
  - bind_context/3
  - bind_new_context/2
  - destroy/1
  - list/2
  - new_context/1
  - rebind/3
  - rebind_context/3
  - resolve/2
  - unbind/2
- CosNaming_NamingContextExt
  - Top of manual page
  - resolve_str/2
  - to_name/2
  - to_string/2
  - to_url/3
- CosNaming_BindingIterator
  - Top of manual page
  - destroy/1
  - next_n/2
  - next_one/1
- lname
  - Top of manual page
  - create/0
  - delete_component/2
  - equal/2
  - from_idl_form/1
  - get_component/2
  - insert_component/3
  - less_than/2
  - num_component/1
  - to_idl_form/1
- lname_component
  - Top of manual page
  - create/0
  - get_id/1
  - get_kind/1
  - set_id/2
  - set_kind/2
- Module_Interface
  - Top of manual page
  - Module_Interface:oe_create/0
  - Module_Interface:oe_create/1
  - Module_Interface:oe_create/2
  - Module_Interface:oe_create_link/0
  - Module_Interface:oe_create_link/1
  - Module_Interface:oe_create_link/2
  - Module_Interface:own_functions/4
  - Module_Interface:own_functions/5
  - Module_Interface:typeID/0
  - Module_Interface_impl:code_change/3
  - Module_Interface_impl:handle_info/2
  - Module_Interface_impl:init/1
  - Module_Interface_impl:own_functions/5
  - Module_Interface_impl:own_functions/4
  - Module_Interface_impl:own_functions/4
  - Module_Interface_impl:own_functions/6
  - Module_Interface_impl:own_functions/5
  - Module_Interface_impl:own_functions/5
  - Module_Interface_impl:terminate/2
- interceptors
  - Top of manual page
  - closed_in_connection/1
  - closed_out_connection/1
  - in_reply/6
  - in_reply_encoded/6
  - in_request/6
  - in_request_encoded/6
  - new_in_connection/3
  - new_in_connection/5
  - new_out_connection/3
  - new_out_connection/5
  - out_reply/6
  - out_reply_encoded/6
  - out_request/6
  - out_request_encoded/6
- orber_diagnostics
  - Top of manual page
  - missing_modules/0
  - nameservice/0
  - nameservice/1

# fixed

### MODULE

fixed

### MODULE SUMMARY

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:

- 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 - fixed<max(d1-s1,d2-s2) + max(s1,s2) + 1, max(s1,s2)>
- Fixed1 - Fixed2 - fixed<max(d1-s1,d2-s2) + max(s1,s2) + 1, max(s1,s2)>
- Fixed1 * Fixed2 - fixed<d1+d2, s1+s2>
- Fixed1 / Fixed2 - fixed<(d1-s1+s2) + Sinf ,Sinf >

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.