eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'LongFloat':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: LongFloat


Inheritance:

   Object
   |
   +--Magnitude
      |
      +--ArithmeticValue
         |
         +--Number
            |
            +--LimitedPrecisionReal
               |
               +--LongFloat

Package:
stx:libbasic
Category:
Magnitude-Numbers
Version:
rev: 1.154 date: 2019/07/24 08:33:24
user: cg
file: LongFloat.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger

Description:


LongFloats represent rational numbers with limited precision.
They use the C-compiler's 'long double' format, 
which is either mapped to the IEEE extended precision (80bit) 
or IEEE quadruple precision format (128bit).

In contrast to Floats (which use the C-compilers 64bit 'double' format),
LongFloats give you 80 bit extended floats, 96 bit extended floats or 128 bit quadruple floats,
depending on the underlying CPU.
Thus, code using longFloats is not guaranteed to be portable from one architecture to another.

NO GARANTY:
    on systems which do not support 'long doubles', LongFloats are (silently)
    represented as 'doubles'.

Representation:
    gcc-x86:
        80bit extended IEEE floats stored in in 96bits (12bytes);
        64 bit mantissa,
        16 bit exponent,
        19 decimal digits (approx.)

    borland-x86 (WIN32):
        80bit extended IEEE floats stored in in 80bits (10bytes);
        64 bit mantissa,
        16 bit exponent,
        19 decimal digits (approx.)

    gcc-x86_64: (WIN64)
        like gcc-x86

    gcc-sparc:
        128bit quadruple IEEE floats (16bytes);
        112 bit mantissa,
        16 bit exponent,
        34 decimal digits (approx.)

Mixed mode arithmetic:
    longFloat op longFloat   -> longFloat
    longFloat op fix         -> longFloat
    longFloat op fraction    -> longFloat
    longFloat op integer     -> longFloat
    longFloat op shortFloat  -> longFloat
    longFloat op float       -> longFloat
    longFloat op complex     -> complex

Range and precision of storage formats: see LimitedPrecisionReal >> documentation


Related information:

    Number
    Float
    ShortFloat
    Fraction
    FixedPoint
    Integer
    Complex
    FloatArray
    DoubleArray
    [ttps]

Class protocol:

accessing
o  defaultPrintFormat

o  defaultPrintFormat: something

class initialization
o  initialize
19 valid digits

usage example(s):

     self initialize

coercing & converting
o  coerce: aNumber
convert the argument aNumber into an instance of the receiver's class and return it.

constants
o  NaN
return a longFloat which represents not-a-Number (i.e. an invalid number)

usage example(s):

     LongFloat NaN

o  e
return the constant e as LongFloat

usage example(s):

eDigits has enough digits for 128bit IEEE quads

usage example(s):

do not use as a literal constant here - we cannot depend on the underlying C-compiler here...

usage example(s):

Modified (format): / 06-06-2019 / 17:02:27 / Claus Gittinger

o  halfpi
return the constant pi/2 as LongFloat

usage example(s):

     self halfpi

o  halfpiNegative
return the constant -pi/2 as LongFloat

usage example(s):

     self halfpiNegative

o  infinity
return a longFloat which represents positive infinity (for my instances).
Warning: do not compare equal against infinities;
instead, check using isFinite or isInfinite

usage example(s):

     LongFloat infinity

o  negativeInfinity
return a longFloat which represents positive infinity (for my instances).
Warning: do not compare equal against infinities;
instead, check using isFinite or isInfinite

usage example(s):

     LongFloat negativeInfinity

o  pi
return the constant pi as LongFloat

usage example(s):

piDigits has enough digits for 128bit IEEE quads

usage example(s):

do not use as a literal constant here - we cannot depend on the underlying C-compiler here...

o  unity
return the neutral element for multiplication (1.0) as LongFloat

o  zero
return the neutral element for addition (0.0) as LongFloat

instance creation
o  basicNew
return a new longFloat - here we return 0.0
- LongFloats are usually NOT created this way ...
Its implemented here to allow things like binary store & load
of longFloats. (but even this support will go away eventually, its not
a good idea to store the bits of a float - the reader might have a
totally different representation - so floats will eventually be
binary stored in a device independent format.

o  fromFloat: aFloat
return a new longFloat, given a float value

usage example(s):

     LongFloat fromFloat:123.0
     123.0 asLongFloat
     123 asLongFloat

o  fromIEEE32Bit: anInteger
creates a long float, given the four native float bytes as an integer

usage example(s):

     LongFloat fromIEEE32Bit:((ShortFloat pi digitBytesMSB:true) asIntegerMSB:true)

o  fromIEEE64Bit: anInteger
creates a long double, given the eight native double bytes as an integer

usage example(s):

	LongFloat fromIEEE64Bit:((Float pi digitBytesMSB:true) asIntegerMSB:true)

o  fromInteger: anInteger
return a new longFloat, given an integer value

usage example(s):

     LongFloat fromInteger:123
     LongFloat fromInteger:(100 factorial)
     (100 factorial) asLongFloat

o  fromShortFloat: aFloat
return a new longFloat, given a shortFloat value

usage example(s):

     LongFloat fromShortFloat:(123.0 asShortFloat)
     LongFloat fromShortFloat:122

queries
o  defaultPrintPrecision
return the number of decimal digits printed by default

usage example(s):

     LongFloat defaultPrintPrecision
     ShortFloat defaultPrintPrecision
     Float defaultPrintPrecision

o  epsilon
return the maximum relative spacing of instances of mySelf
(i.e. the value-delta of the least significant bit)

o  exponentCharacter
return the character used to print between mantissa an exponent.
Also used by the scanner when reading numbers.

o  isBuiltInClass
return true if this class is known by the run-time-system.
Here, true is returned for myself, false for subclasses.

o  numBitsInExponent
answer the number of bits in the exponent
i386: This is an 80bit longfloat stored in 96 bits (upper 16 bits are unused),
where 15 bits are available in the exponent (i bit is ignored):
00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
x86_64: This is an 80bit longfloat stored in 128 bits (upper 48 bits are unused),
where 15 bits are available in the exponent:
00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
sparc & others: This is an 128bit longfloat,
where 15 bits are available in the exponent:
seeeeeee eeeeeeee mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm...

usage example(s):

     1.0 asLongFloat numBitsInExponent

o  numBitsInIntegerPart
answer the number of bits in the hidden integer part of the mantissa.
This will return 0 or 1; 0 if there is no hidden bit, 1 if there is.
i386: This is an 80bit longfloat stored in 96 bits (upper 16 bits are unused),
where 1 bit is used for the integer part in the mantissa:
00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
x86_64: This is an 80bit longfloat stored in 128 bits (upper 48 bits are unused),
where 1+63 bits are available in the mantissa:
00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
sparc & others: This is an 128bit longfloat,
where 112 bits are available in the mantissa:
seeeeeee eeeeeeee mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm...

usage example(s):

     self numBitsInIntegerPart
     1.0 asLongFloat numBitsInIntegerPart
     1.0 asFloat numBitsInIntegerPart
     1.0 asShortFloat numBitsInIntegerPart

o  numBitsInMantissa
answer the number of bits in the mantissa
the hidden bit is not counted here:

i386: This is an 80bit longfloat stored in 96 bits (upper 16 bits are unused),
where 1+63 bits are available in the mantissa:
00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
x86_64: This is an 80bit longfloat stored in 128 bits (upper 48 bits are unused),
where 1+63 bits are available in the mantissa:
00000000 00000000 seeeeeee eeeeeeee immmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
sparc: This is an 128bit longfloat,
where 112 bits are available in the mantissa:
seeeeeee eeeeeeee mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm...

usage example(s):

     1.0 class numBitsInMantissa
     1.0 asShortFloat class numBitsInMantissa
     1.0 asLongFloat class numBitsInMantissa

o  radix
answer the radix of a LongFloat's exponent
This is an IEEE float, which is represented as binary


Instance protocol:

arithmetic
o  * aNumber
return the product of the receiver and the argument.

o  + aNumber
return the sum of the receiver and the argument, aNumber

o  - aNumber
return the difference of the receiver and the argument, aNumber

o  / aNumber
return the quotient of the receiver and the argument, aNumber

o  abs
return the absolute value of the receiver
reimplemented here for speed

usage example(s):

     3.0 asLongFloat abs
     -3.0 asLongFloat abs

o  negated
return myself negated

o  rem: aNumber
return the floating point remainder of the receiver and the argument, aNumber

o  uncheckedDivide: aNumber
return the quotient of the receiver and the argument, aNumber.
Do not check for divide by zero (return NaN or Infinity).
This operation is provided for emulators of other languages/semantics,
where no exception is raised for these results (i.e. Java).
It is only defined if the argument's type is the same as the receiver's.

usage example(s):

      0.0 asLongFloat uncheckedDivide:0
      1.0 asLongFloat uncheckedDivide:0.0
      -1.0 asLongFloat uncheckedDivide:0.0

coercing & converting
o  asFloat
return a Float with same value as the receiver.
Raises an error if the receiver exceeds the float range.

o  asInteger
return an integer with same value - might truncate

usage example(s):

     12345.0 asLongFloat asInteger
     1e15 asLongFloat asInteger

o  asLongFloat
return a LongFloat with same value as the receiver - that's me

o  asQuadFloat
return a QuadFloat with same value as the receiver

o  asShortFloat
return a ShortFloat with same value as the receiver.
Raises an error if the receiver exceeds the short float range.

usage example(s):

     1.0 asLongFloat asShortFloat

     out of range:
        3.5028234664e+38 asShortFloat
        -3.5028234664e+38 asShortFloat

o  coerce: aNumber
convert the argument aNumber into an instance of the receiver's class and return it.

o  generality
return the generality value - see ArithmeticValue>>retry:coercing:

comparing
o  < aNumber
return true, if the argument is greater

o  <= aNumber
return true, if the argument is greater or equal

o  = aNumber
return true, if the argument represents the same numeric value
as the receiver, false otherwise

o  > aNumber
return true, if the argument is less

o  >= aNumber
return true, if the argument is less or equal

o  hash
return a number for hashing; redefined, since floats compare
by numeric value (i.e. 3.0 = 3), therefore 3.0 hash must be the same
as 3 hash.

usage example(s):

     1.2345 hash
     1.2345 asLongFloat hash
     1 hash
     1.0 hash
     1.0 asLongFloat hash

o  isAlmostEqualTo: aNumber nEpsilon: nE
return true, if the argument, aNumber represents almost the same numeric value
as the receiver, false otherwise.

nE is the number of minimal float distances, that the numbers may differ and
still be considered equal.

For background information why floats need this
read: http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/

usage example(s):

	67329.234q isAlmostEqualTo:67329.234q + self epsilon nEpsilon:1
	1.0 asLongFloat isAlmostEqualTo:1.0001 nEpsilon:1
	1.0 asLongFloat isAlmostEqualTo:-1.0 nEpsilon:1
	1.0 asLongFloat isAlmostEqualTo:1 nEpsilon:1
	0.0 asLongFloat isAlmostEqualTo:0 nEpsilon:1
	0.0 asLongFloat isAlmostEqualTo:self epsilon nEpsilon:1

o  ~= aNumber
return true, if the arguments value are not equal.

copying
o  deepCopy
return a deep copy of myself
- because storing into floats is not recommended/allowed, its ok to return the receiver

o  deepCopyUsing: aDictionary postCopySelector: postCopySelector
return a deep copy of myself
- because storing into floats is not recommended/allowed, its ok to return the receiver

o  shallowCopy
return a shallow copy of the receiver

o  simpleDeepCopy
return a deep copy of the receiver
- because storing into floats is not recommended/allowed, its ok to return the receiver

double dispatching
o  productFromInteger: anInteger
sent when an integer does not know how to multiply the receiver, self

o  sumFromInteger: anInteger
sent when an integer does not know how to add the receiver, self

mathematical functions
o  exp
return e raised to the power of the receiver

o  ln
return the natural logarithm of myself.
Raises an exception, if the receiver is less or equal to zero.

o  log10
return the base-10 logarithm of the receiver.
Raises an exception, if the receiver is less or equal to zero.

o  raisedTo: aNumber
return self raised to the power of aNumber

o  sqrt
return the square root of myself.
Raises an exception, if the receiver is less than zero.

usage example(s):

     10 asLongFloat sqrt
     -10 asLongFloat sqrt

printing & storing
o  printOn: aStream
append a printed representation of the receiver to
the argument, aStream.

I use #printString instead of #printOn: as basic print mechanism.

o  printString
return a printed representation of the receiver
LimitedPrecisonReal and its subclasses use #printString instead of
#printOn: as basic print mechanism.

usage example(s):

	LongFloat pi printString.
	1.234 asLongFloat printString.
	1.0 asLongFloat printString.
	1e10 asLongFloat printString.
	1.2e3 asLongFloat printString.
	1.2e30 asLongFloat printString.
	(1.0 uncheckedDivide:0) asLongFloat printString.
	(0.0 uncheckedDivide:0) asLongFloat printString.
	self pi printString.

	DecimalPointCharacterForPrinting := $,.
	1.234 asLongFloat printString.
	1.0 asLongFloat printString.
	1e10 asLongFloat printString.
	1.2e3 asLongFloat printString.
	1.2e30 asLongFloat printString.
	(1.0 uncheckedDivide:0) asLongFloat printString.
	(0.0 uncheckedDivide:0) asLongFloat printString.
	DecimalPointCharacterForPrinting := $.

o  printStringWithFormat: format
return a printed representation of the receiver;
fmt must be of the form: .nn, where nn is the number of digits.
To print 6 valid digits, use printStringWithFormat:'.6'
For Floats, the default used in printString, is 15 (because its a double);
for ShortFloats, it is 6 (because it is a float)

o  printfPrintString: formatString
non-standard: return a printed representation of the receiver
as specified by formatString, which is defined by printf.

If you use this, be aware, that specifying long doubles differs on
systems; on Linux/gnuc machines you have to give something like %LF/%LG.
Also, the resulting string may not be longer than 255 bytes -
since that's the (static) size of the buffer.

This method is NONSTANDARD and may be removed without notice.
WARNNG: this goes directly to the C-printf function and may therefore me inherently unsafe.
Please use the printf: method, which is safe as it is completely implemented in Smalltalk.

usage example(s):

     Float pi asLongFloat printfPrintString:'%%LG -> %LG'
     Float pi asLongFloat printfPrintString:'%%LF -> %LF'
     Float pi asLongFloat printfPrintString:'%%7.15LG -> %7.15LG'
     Float pi asLongFloat printfPrintString:'%%7.15LF -> %7.15LF'

o  storeOn: aStream
append a printed representation of the receiver to
the argument, aStream.

I use #storeString instead of #storeOn: as basic store mechanism.

o  storeString
return a printed representation of the receiver;
all valid digits are printed.
LimitedPrecisonReal and its subclasses use #storeString instead of
#storeOn: as basic print mechanism.

usage example(s):

	1.0 asLongFloat storeString
	1.234 asLongFloat storeString
	1e10 asLongFloat storeString
	1.2e3 asLongFloat storeString
	1.2e30 asLongFloat storeString
	LongFloat pi asLongFloat storeString
	(1.0 uncheckedDivide:0) asLongFloat storeString
	(0.0 uncheckedDivide:0) asLongFloat storeString

     notice that the storeString is NOT affected by DecimalPointCharacterForPrinting:

	DecimalPointCharacterForPrinting := $,.
	1.234 asLongFloat storeString.
	1.0 asLongFloat storeString.
	1e10 asLongFloat storeString.
	1.2e3 asLongFloat storeString.
	1.2e30 asLongFloat storeString.
	(1.0 uncheckedDivide:0) asLongFloat storeString.
	(0.0 uncheckedDivide:0) asLongFloat storeString.
	DecimalPointCharacterForPrinting := $.

private-accessing
o  basicAt: index
return an internal byte of the float.
The value returned here depends on byte order, float representation etc.
Therefore, this method should be used strictly private.

Notice:
the need to redefine this method here is due to the
inability of many machines to store floats in non-double aligned memory.
Therefore, on some machines, the first <nPad> bytes of a float are left unused,
and the actual float is stored at index <nPad>+1 ...
To hide this at one place, this method knows about that, and returns
values as if this filler wasnt present.

o  basicAt: index put: value
set an internal byte of the float.
The value to be stored here depends on byte order, float representation etc.
Therefore, this method should be used strictly private.

Notice:
the need to redefine this method here is due to the
inability of many machines to store floats in non-double aligned memory.
Therefore, on some machines, the first <nPad> bytes of a float are left unused,
and the actual float is stored at index <nPad>+1 .. .
To hide this at one place, this method knows about that, and returns
values as if this filler wasnt present.

o  basicSize
return the size in bytes of the float.

Notice:
the need to redefine this method here is due to the
inability of many machines to store floats in non-double aligned memory.
Therefore, on some machines, the first <nPad> bytes of a float are left unused,
and the actual float is stored at index <nPad>+1 ...
To hide this at one place, this method knows about that, and returns
values as if this filler wasnt present.

o  byteAt: index

o  byteAt: index put: newByte

special access
o  exponent
extract a normalized float's exponent.
The returned value depends on the float-representation of
the underlying machine and is therefore highly unportable.
This is not for general use.
This assumes that the mantissa is normalized to
0.5 .. 1.0 and the float's value is mantissa * 2^exp

usage example(s):

     4.0q exponent
     2.0q exponent
     1.0q exponent
     0.5q exponent
     0.25q exponent
     0.00000011111q exponent
     1.0q1000 exponent

o  mantissa
extract a normalized float's mantissa.
The returned value depends on the float-representation of
the underlying machine and is therefore highly unportable.
This is not for general use.
This assumes that the mantissa is normalized to
0.5 .. 1.0 and the float's value is mantissa * 2^exp

usage example(s):

     1.0q exponent
     1.0q asLongFloat mantissa

     0.5q exponent
     0.5q  mantissa

     0.25q exponent
     0.25q mantissa

     0.00000011111q exponent
     0.00000011111q mantissa

testing
o  isFinite
return true, if the receiver is a finite float
i.e. not NaN and not infinite.

usage example(s):

	1.0 asLongFloat isFinite
	(0.0 asLongFloat uncheckedDivide: 0.0) isFinite
	(1.0 asLongFloat uncheckedDivide: 0.0) isFinite
	(-1.0 asLongFloat uncheckedDivide: 0.0) isFinite

o  isInfinite
return true, if the receiver is an infinite float (Inf).
These are not created by ST/X float operations (they raise an exception);
however, inline C-code could produce them ...
Redefined here for speed

usage example(s):

	1.0 asLongFloat isFinite -> true
	1.0 asLongFloat isInfinite -> false

	(0.0 asLongFloat uncheckedDivide: 0.0) isFinite -> false
	(0.0 asLongFloat uncheckedDivide: 0.0) isInfinite -> false
	(0.0 asLongFloat uncheckedDivide: 0.0) isNaN -> true

	(1.0 asLongFloat uncheckedDivide: 0.0) isFinite -> false
	(1.0 asLongFloat uncheckedDivide: 0.0) isInfinite -> true
	(1.0 asLongFloat uncheckedDivide: 0.0) isNaN -> false

	(-1.0 asLongFloat uncheckedDivide: 0.0) isFinite -> false
	(-1.0 asLongFloat uncheckedDivide: 0.0) isInfinite -> true
	(-1.0 asLongFloat uncheckedDivide: 0.0) isNaN -> false

o  isNaN
return true, if the receiver is an invalid float (NaN - not a number).
These are not created by ST/X float operations (they raise an exception);
however, inline C-code could produce them ...

usage example(s):

	1.0 asLongFloat isNaN
	(0.0 asLongFloat uncheckedDivide: 0.0) isNaN

o  isNegativeZero
many systems have two float.Pnt zeros

usage example(s):

     0.0 asLongFloat isNegativeZero
     -0.0 asLongFloat isNegativeZero

o  isZero
return true, if the receiver is zero

o  negative
return true if the receiver is less than zero.
-0.0 is positive for now.

usage example(s):

	0.0 asLongFloat negative
	-0.0 asLongFloat negative
	1.0 asLongFloat negative
	-1.0 asLongFloat negative
	(1.0 uncheckedDivide: 0.0) asLongFloat negative
	(-1.0 uncheckedDivide: 0.0) asLongFloat negative

o  numberOfBits
return the size (in bits) of the real;
typically, 80 or 96 is returned here,
but who knows ...

usage example(s):

     LongFloat basicNew numberOfBits
     1.2 asLongFloat numberOfBits
     1.2 asShortFloat numberOfBits
     1.2 numberOfBits

o  positive
return true if the receiver is greater or equal to zero (not negative)
0.0 and -0.0 are positive for now.

usage example(s):

	0.0 asLongFloat positive
	-0.0 asLongFloat positive
	1.0 asLongFloat positive
	-1.0 asLongFloat positive
	(1.0 uncheckedDivide: 0.0) asLongFloat positive
	(-1.0 uncheckedDivide: 0.0) asLongFloat positive

o  strictlyPositive
return true if the receiver is greater than zero

trigonometric
o  arcCos
return the arccosine of the receiver (as radians).
Raises an exception, if the receiver is not in -1..1

usage example(s):

     -10 asLongFloat arcCos
     1 asLongFloat arcCos
     0.5 asLongFloat arcCos

o  arcCosh
return the hyperbolic arccosine of the receiver.

usage example(s):

     -10 asLongFloat arcCosh
     1 asLongFloat arcCosh
     0.5 asLongFloat arcCosh

o  arcSin
return the arcsine of the receiver (as radians).
Raises an exception, if the receiver is not in -1..1

usage example(s):

     -10 asLongFloat arcSin
     1 asLongFloat arcSin
     0.5 asLongFloat arcSin

o  arcSinh
return the hyperbolic arcsine of the receiver.

usage example(s):

     -10 asLongFloat arcSinh
     1 asLongFloat arcSinh
     0.5 asLongFloat arcSinh

o  arcTan
return the arctangent of the receiver (as radians)

o  arcTanh
return the hyperbolic arctangent of the receiver.

o  cos
return the cosine of the receiver (interpreted as radians)

o  cosh
return the hyperbolic cosine of the receiver

o  sin
return the sine of the receiver (interpreted as radians)

o  sinh
return the hyperbolic sine of the receiver

o  tan
return the tangens of the receiver (interpreted as radians)

o  tanh
return the hyperbolic tangens of the receiver

truncation & rounding
o  ceiling
return the smallest integer which is greater or equal to the receiver.

usage example(s):

     0.5q ceiling
     -0.5q ceiling

o  ceilingAsFloat
return the smallest integer-valued float greater or equal to the receiver.
This is much like #ceiling, but avoids a (possibly expensive) conversion
of the result to an integer.
It may be useful, if the result is to be further used in another float-operation.

usage example(s):

     0.5q ceilingAsFloat
     -0.5q ceilingAsFloat
     -1.5q ceilingAsFloat

o  floor
return the integer nearest the receiver towards negative infinity.

usage example(s):

     0.5q floor
     -0.5q floor

o  floorAsFloat
return the float which represents the next lower
integer nearest the receiver towards negative infinity.
Much like floor, but returns a float result - useful if the result
will be used in another float operation, to avoid costy int-conversion.

usage example(s):

     0.5q floorAsFloat
     -0.5q floorAsFloat
     -1.5q floorAsFloat

o  fractionPart
extract the after-decimal fraction part.
such that (self truncated + self fractionPart) = self

usage example(s):

     1.6q fractionPart + 1.6q truncated
     -1.6q fractionPart + -1.6q truncated

     1.0q fractionPart
     2.0q fractionPart
     3.0 asLongFloat fractionPart
     4.0 asLongFloat fractionPart
     0.5 asLongFloat fractionPart
     0.25 asLongFloat fractionPart
     3.14159 asLongFloat fractionPart
     12345673.14159 asLongFloat fractionPart
     123456731231231231.14159 asLongFloat fractionPart

     3.14159 asLongFloat fractionPart + 3.14159 asLongFloat truncated

     12345673.14159 asLongFloat fractionPart + 12345673.14159 asLongFloat truncated

     123456731231231231.14159 asLongFloat fractionPart + 123456731231231231.14159 asLongFloat truncated

o  rounded
return the receiver rounded to the nearest integer

usage example(s):

     0.4q rounded
     0.5q rounded
     0.6qqrounded
     -0.4q rounded
     -0.5q rounded
     -0.6q rounded

o  roundedAsFloat
return the receiver rounded to the nearest integer as a float.
This is much like #rounded, but avoids a (possibly expensive) conversion
of the result to an integer.
It may be useful, if the result is to be further used in another float-operation.

o  truncated
return the receiver truncated towards zero as an integer

usage example(s):

     0.5q truncated
     -0.5q truncated
     0.5q truncatedAsFloat
     -0.5q truncatedAsFloat

o  truncatedAsFloat
return the receiver truncated towards zero as a float.
This is much like #truncated, but avoids a (possibly expensive) conversion
of the result to an integer.
It may be useful, if the result is to be further used in another
float-operation.

usage example(s):

     0.5q truncated
     -0.5q truncated
     0.5q truncatedAsFloat
     -0.5q truncatedAsFloat



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Thu, 26 May 2022 11:40:24 GMT