Oracle Coherence for C++ API
Release 3.6.1.0

E18813-01

Float32 Class Reference

#include <coherence/lang/Float32.hpp>

Inherits Primitive< float32_t >, Number, and Comparable.

List of all members.


Detailed Description

An immutable 32-bit floating-point value.
Author:
jh 2008.04.01

Public Types

typedef spec::Handle  Handle
  Float32 Handle definition.
typedef spec::View  View
  Float32 View definition.
typedef spec::Holder  Holder
  Float32 Holder definition.

Public Member Functions

virtual int16_t  getInt16Value () const
  Return the numeric value of this object as an int16_t.

This may involve rounding or truncation.

Returns:
the numeric value of this object as an int16_t

virtual int32_t  getInt32Value () const
  Return the numeric value of this object as an int32_t.

This may involve rounding or truncation.

Returns:
the numeric value of this object as an int32_t

virtual int64_t  getInt64Value () const
  Return the numeric value of this object as an int64_t.

This may involve rounding or truncation.

Returns:
the numeric value of this object as an int64_t

virtual float32_t  getFloat32Value () const
  Return the numeric value of this object as a float32_t.

This may involve rounding.

Returns:
the numeric value of this object as a float32_t

virtual float64_t  getFloat64Value () const
  Return the numeric value of this object as a float64_t.

This may involve rounding.

Returns:
the numeric value of this object as a float64_t

virtual int32_t  compareTo (Object::View v) const
  Compare this object with the specified object for order.

Return a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object.

It is strongly recommended, but not strictly required, that (x->compareTo(y) == 0) == (x->equals(y)).

Parameters:
v  the Object to be compared
Returns:
a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object
Exceptions:
ClassCastException  if the specified Object's type prevents it from being compared to this Object

virtual bool  equals (Object::View v) const
  Return true iff the specified Object is "equal" to this Object.

This method implements an equivalence relation on Objects:

  • It is reflexive: for any non-null handle h, h->equals(h) must return true.
  • It is symmetric: for any non-null handles h1 and h2, h1->equals(h2) should return true if and only if h2->equals(h1) returns true.
  • It is transitive: for any non-null handles h1, h2, and h3, if h1->equals(h2) returns true and h2->equals(h3) returns true, then h1->equals(h3) should return true.
  • It is consistent: for any non-null handles h1 and h2, multiple invocations of h1->equals(h2) consistently return true or consistently return false, provided no information used in comparisons on the objects is modified.
  • If the supplied handle is NULL then false must be returned.

The default implementation is a reference equality comparison.

Parameters:
v  the Object::View to compare against, may be NULL
Returns:
true iff the given handle references an Object that is "equal" to this Object
See also:
equals(Object::View v1, Object::View v2)

virtual size32_t  hashCode () const
  Return a hash code value for the Object.

This method is supported for the benefit of hash-based containers.

The general contract of hashCode is:

  • Whenever it is invoked on the same Object more than once during an execution of an application, the hashCode method must consistently return the same value, provided no information used in equals comparisons on the object is modified. This value need not remain consistent from one execution of an application to another execution of the same application.
  • If two Objects are equal according to the equals method, then calling the hashCode method on each of the two Objects must produce the same value.
  • It is not required that if two Objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct results. However, the programmer should be aware that producing distinct results for unequal objects may improve the performance of hash-based containers.

The default implementation is identity based.

Returns:
a hash code value for this Object


Static Public Member Functions

static uint32_t  float32ToBits (float32_t fl)
  Return a uint32_t representation of the specified 32-bit floating point value according to the IEEE 754 floating-point "single format" bit layout.
static float32_t  bitsToFloat32 (uint32_t n)
  Return the float32_t value corresponding to a given bit representation.
static Handle  valueOf (float32_t fl)
  Factory method to produce Float32 objects with an optimization that uses cached objects for all common numbers.
static bool  isNaN (float32_t fl)
  Test whether the given float32_t is a NaN.
static bool  isZero (float32_t fl)
  Test whether the given float32_t is -0.0 or 0.0.
static bool  isInfinite (float32_t fl)
  Test whether the given float32_t is -infinity or +infinity.
static int32_t  compare (float32_t fll, float32_t flr)
  Compare the given float32_t values for order.
static float32_t  getNaN ()
  Return a constant holding the Not-a-Number (NaN) value of type float32_t.
static float32_t  getPositiveInfinity ()
  Return a constant holding the positive infinity value of type float32_t.
static float32_t  getNegativeInfinity ()
  Returns a constant holding the negative infinity value of type float32_t.

Member Function Documentation

static uint32_t float32ToBits ( float32_t  fl  )  [static]

Return a uint32_t representation of the specified 32-bit floating point value according to the IEEE 754 floating-point "single format" bit layout.

Parameters:
fl  a 32-bit floating-point number
Returns:
the uint32_t representation of the floating-point number

static float32_t bitsToFloat32 ( uint32_t  n  )  [static]

Return the float32_t value corresponding to a given bit representation.

The argument is considered to be a representation of a 32-bit floating-point value according to the IEEE 754 floating-point "single format" bit layout.

Parameters:
n  a 32-bit unsigned integer containing the bit representation of the floating-point number
Returns:
the float32_t floating-point value with the same bit pattern.

static Handle valueOf ( float32_t  fl  )  [static]

Factory method to produce Float32 objects with an optimization that uses cached objects for all common numbers.

Parameters:
fl  a float32_t
Returns:
a Float32 whose value is the passed float32_t

static bool isNaN ( float32_t  fl  )  [static]

Test whether the given float32_t is a NaN.

Parameters:
fl  a float32_t to test
Returns:
true if the given float32_t is a NaN, else return false

static bool isZero ( float32_t  fl  )  [static]

Test whether the given float32_t is -0.0 or 0.0.

Parameters:
fl  a float32_t to test
Returns:
true if the given float32_t is a zero, else return false

static bool isInfinite ( float32_t  fl  )  [static]

Test whether the given float32_t is -infinity or +infinity.

Parameters:
fl  a float32_t to test
Returns:
true if the given float32_t is infinite else return false

static int32_t compare ( float32_t  fll,
float32_t  flr  
) [static]

Compare the given float32_t values for order.

Return a negative integer, zero, or a positive integer if the left value is less than, equal to, or greater than the right. The comparison is based on the following order: -infinity < -0.0 < +0.0 < +infinity < NaN

Parameters:
fll  the left hand value to be compared
flr  the right hand value to be compared
Returns:
a negative integer, zero, or a positive integer if the left value is less than, equal to, or greater than the right value

static float32_t getNaN (  )  [static]

Return a constant holding the Not-a-Number (NaN) value of type float32_t.

It is equivalent to the value returned by Float32::bitsToFloat32(0x7FC00000).

Returns:
the float32_t NaN value

static float32_t getPositiveInfinity (  )  [static]

Return a constant holding the positive infinity value of type float32_t.

It is equal to the value returned by Float32::bitsToFloat32(0x7F800000).

Returns:
the float32_t positive infinity value

static float32_t getNegativeInfinity (  )  [static]

Returns a constant holding the negative infinity value of type float32_t.

It is equal to the value returned by Float32::bitsToFloat(0xFF800000).

Returns:
the float32_t negative infinity value

The documentation for this class was generated from the following file:
Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.