expanded class REAL_32

Features exported to ANY

32 bits floating point.

Direct parents

conformant parents

REAL_GENERAL

Summary

exported features

Conversions:

Conversions:

Object Printing:

Maths functions:

Miscellaneous:

Details

to_real_64: REAL

Explicit conversion to REAL_64.

ensure

  • Current = Result

to_real: REAL

Explicit conversion to REAL_64.

ensure

  • Current = Result

to_real_extended: REAL_EXTENDED

Explicit conversion to REAL_EXTENDED.

ensure

  • Current = Result

to_real_80: REAL_EXTENDED

Explicit conversion to REAL_80.

ensure

  • Current = Result

to_real_128: REAL_EXTENDED

Explicit conversion to REAL_128.

ensure

  • Current = Result

force_to_integer_32: INTEGER
force_to_integer_64: INTEGER_64
zero: REAL_32

Neutral element for "+" and "-".

one: REAL_32

Neutral element for "*" and "/".

hash_code: INTEGER

The hash-code value of Current.

ensure

  • good_hash_value: Result >= 0

mantissa_bits: INTEGER_8

Give the number of bits, corresponding to the mantissa, in the binary representation of the real number.

exponent_bits: INTEGER_8

Give the number of bits, corresponding to the exponent, in the binary representation of the real number.

is_equal (other: REAL_32): BOOLEAN

Is other attached to an object considered equal to current object ?

require

  • other /= Void

ensure

  • trichotomy: Result = (not (Current < other) and not (other < Current))
  • commutative: generating_type = other.generating_type implies Result = other.is_equal(Current)
  • Result implies hash_code = other.hash_code

+: REAL_32

Unary plus of Current.

-: REAL_32

Unary minus of Current.

+ (other: REAL_32): REAL_32

Sum with other (commutative).

- (other: REAL_32): REAL_32

Result of substracting other.

* (other: REAL_32): REAL_32

Product by other.

/ (other: REAL_32): REAL_32

Division by other.

require

  • other /= Void
  • divisible(other)

^ (e: INTEGER): REAL_32

Raise Current to e-th power (see also pow).

< (other: REAL_32): BOOLEAN

Is Current strictly less than other?

See also >, <=, >=, min, max.

require

  • other_exists: other /= Void

ensure

  • asymmetric: Result implies not (other < Current)

<= (other: REAL_32): BOOLEAN

Is Current less than or equal other?

See also >=, <, >, min, max.

require

  • other_exists: other /= Void

ensure

  • definition: Result = (Current < other or is_equal(other))

> (other: REAL_32): BOOLEAN

Is Current strictly greater than other?

See also <, >=, <=, min, max.

require

  • other_exists: other /= Void

ensure

  • definition: Result = (other < Current)

>= (other: REAL_32): BOOLEAN

Is Current greater than or equal than other?

See also <=, >, <, min, max.

require

  • other_exists: other /= Void

ensure

  • definition: Result = (other <= Current)

abs: REAL_32
is_not_a_number: BOOLEAN

Also known as NaN in IEEE-754.

is_infinity: BOOLEAN

Is either plus or minus infinity?

is_zero: BOOLEAN

Is either -0.0 or +0.0 ?

~= (other: REAL_32): BOOLEAN

Is Current near equal to other.

is_subnormal: BOOLEAN

Is it too small to be represented in normalized format.

ensure

  • Result = (Current = 0.0) or else Current = -0.0

is_normal: BOOLEAN

The most general situation (see ensure).

ensure

  • Result = not (is_subnormal or is_infinity or is_not_a_number)

divisible (other: REAL_32): BOOLEAN

May Current be divided by other ?

require

  • other /= Void

frozen rounded: REAL_32

Round to nearest integer away from zero.

frozen floor: REAL_32

Largest integral value no greater than Current.

frozen ceiling: REAL_32

Smallest integral value no smaller than Current.

to_string: STRING

Convert Current into a new allocated STRING using 6 as the default number of digits for the fractional part. Exemple: (1.5).to_string will return "1.500000".

Note: see also to_string_format, to_string_scientific as well as append_in to save memory.

to_string_format (f: INTEGER): STRING

Convert Current into a new allocated STRING using f digits for fractional part. Exemple: (1.5).to_string_format(2) will return "1.50".

Note: see also to_string_scientific, to_string as well as append_in_format to save memory.

require

  • f >= 0

to_string_scientific (f: INTEGER): STRING

Convert Current into a new allocated STRING, using the scientific notation with f digits for the fractional part. Exemple: (155.5).to_string_scientific(4) will return "1.5550e+02".

Note: see also to_string, to_string_format as well as append_in_scientific to save memory.

append_in (buffer: STRING)

Append the equivalent of to_string at the end of buffer. Thus you can save memory because no other STRING is allocate for the job.

require

  • buffer /= Void

append_in_format (str: STRING, f: INTEGER)

Append the equivalent of to_string_format at the end of buffer. Thus you can save memory because no other STRING is allocate for the job.

require

  • str /= Void
  • f >= 0

append_in_scientific (str: STRING, f: INTEGER)

Append the equivalent of to_string_scientific at the end of buffer. Thus you can save memory because no other STRING is allocate for the job.

require

  • str /= Void
  • f >= 0

out_in_tagged_out_memory

Append terse printable represention of current object in tagged_out_memory.

ensure

  • not_cleared: tagged_out_memory.count >= old tagged_out_memory.count
  • append_only: (old tagged_out_memory.twin).is_equal(tagged_out_memory.substring(1, old tagged_out_memory.count))

fill_tagged_out_memory

Append a viewable information in tagged_out_memory in order to affect the behavior of out, tagged_out, etc.

frozen sqrt: REAL_32

Square root of Current.

require

  • Current >= 0.0

frozen sin: REAL_32

Sine of Current.

frozen cos: REAL_32

Cosine of Current.

frozen tan: REAL_32

Tangent of Current.

frozen asin: REAL_32

Arc Sine of Current.

frozen acos: REAL_32

Arc Cosine of Current.

frozen atan: REAL_32

Arc Tangent of Current.

frozen atan2 (x: REAL_32): REAL_32

Arc Tangent of Current / x.

frozen sinh: REAL_32

Hyperbolic Sine of Current.

frozen cosh: REAL_32

Hyperbolic Cosine of Current.

frozen tanh: REAL_32

Hyperbolic Tangent of Current.

frozen exp: REAL_32

Exponential of Current.

frozen log: REAL_32

Natural Logarithm of Current.

frozen log10: REAL_32

Base-10 Logarithm of Current.

frozen pow (e: REAL_32): REAL_32

Current raised to the power of e (ANSI C pow).

sign: INTEGER_8

Sign of Current (0 -1 or 1).

ensure

  • -1 <= Result
  • Result <= 1

deferred is_equal (other: REAL_32): BOOLEAN

Is other attached to an object considered equal to current object ?

require

  • other /= Void

ensure

  • Result implies hash_code = other.hash_code
  • commutative: generating_type = other.generating_type implies Result = other.is_equal(Current)

is_equal (other: REAL_32): BOOLEAN

Is other attached to an object considered equal to current object ?

require

  • other /= Void

ensure

  • trichotomy: Result = (not (Current < other) and not (other < Current))
  • commutative: generating_type = other.generating_type implies Result = other.is_equal(Current)

in_range (lower: REAL_32, upper: REAL_32): BOOLEAN

Return True if Current is in range [lower..upper]

See also min, max, compare.

ensure

  • Result = (Current >= lower and Current <= upper)

compare (other: REAL_32): INTEGER

If current object equal to other, 0 if smaller, -1; if greater, 1.

See also min, max, in_range.

require

  • other_exists: other /= Void

ensure

  • equal_zero: Result = 0 = is_equal(other)
  • smaller_negative: Result = -1 = (Current < other)
  • greater_positive: Result = 1 = (Current > other)

three_way_comparison (other: REAL_32): INTEGER

If current object equal to other, 0 if smaller, -1; if greater, 1.

See also min, max, in_range.

require

  • other_exists: other /= Void

ensure

  • equal_zero: Result = 0 = is_equal(other)
  • smaller_negative: Result = -1 = (Current < other)
  • greater_positive: Result = 1 = (Current > other)

min (other: REAL_32): REAL_32

Minimum of Current and other.

See also max, in_range.

require

  • other /= Void

ensure

  • Result <= Current and then Result <= other
  • compare(Result) = 0 or else other.compare(Result) = 0

max (other: REAL_32): REAL_32

Maximum of Current and other.

See also min, in_range.

require

  • other /= Void

ensure

  • Result >= Current and then Result >= other
  • compare(Result) = 0 or else other.compare(Result) = 0