
Class: LongFloat
Object

+Magnitude

+ArithmeticValue

+Number

+LimitedPrecisionReal

+LongFloat
 Package:
 stx:libbasic
 Category:
 MagnitudeNumbers
 Version:
 rev:
1.154
date: 2019/07/24 08:33:24
 user: cg
 file: LongFloat.st directory: libbasic
 module: stx stcclassLibrary: libbasic
 Author:
 Claus Gittinger
LongFloats represent rational numbers with limited precision.
They use the Ccompiler'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 Ccompilers 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:
gccx86:
80bit extended IEEE floats stored in in 96bits (12bytes);
64 bit mantissa,
16 bit exponent,
19 decimal digits (approx.)
borlandx86 (WIN32):
80bit extended IEEE floats stored in in 80bits (10bytes);
64 bit mantissa,
16 bit exponent,
19 decimal digits (approx.)
gccx86_64: (WIN64)
like gccx86
gccsparc:
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
Number
Float
ShortFloat
Fraction
FixedPoint
Integer
Complex
FloatArray
DoubleArray
[ttps]
accessing

defaultPrintFormat


defaultPrintFormat: something

class initialization

initialize

19 valid digits
usage example(s):
coercing & converting

coerce: aNumber

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

NaN

return a longFloat which represents notaNumber (i.e. an invalid number)
usage example(s):

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 Ccompiler here...

usage example(s):
Modified (format): / 06062019 / 17:02:27 / Claus Gittinger


halfpi

return the constant pi/2 as LongFloat
usage example(s):

halfpiNegative

return the constant pi/2 as LongFloat
usage example(s):

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):

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


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 Ccompiler here...


unity

return the neutral element for multiplication (1.0) as LongFloat

zero

return the neutral element for addition (0.0) as LongFloat
instance creation

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.

fromFloat: aFloat

return a new longFloat, given a float value
usage example(s):
LongFloat fromFloat:123.0
123.0 asLongFloat
123 asLongFloat


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)


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)


fromInteger: anInteger

return a new longFloat, given an integer value
usage example(s):
LongFloat fromInteger:123
LongFloat fromInteger:(100 factorial)
(100 factorial) asLongFloat


fromShortFloat: aFloat

return a new longFloat, given a shortFloat value
usage example(s):
LongFloat fromShortFloat:(123.0 asShortFloat)
LongFloat fromShortFloat:122

queries

defaultPrintPrecision

return the number of decimal digits printed by default
usage example(s):
LongFloat defaultPrintPrecision
ShortFloat defaultPrintPrecision
Float defaultPrintPrecision


epsilon

return the maximum relative spacing of instances of mySelf
(i.e. the valuedelta of the least significant bit)

exponentCharacter

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

isBuiltInClass

return true if this class is known by the runtimesystem.
Here, true is returned for myself, false for subclasses.

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


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


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


radix

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

* aNumber

return the product of the receiver and the argument.

+ aNumber

return the sum of the receiver and the argument, aNumber

 aNumber

return the difference of the receiver and the argument, aNumber

/ aNumber

return the quotient of the receiver and the argument, aNumber

abs

return the absolute value of the receiver
reimplemented here for speed
usage example(s):
3.0 asLongFloat abs
3.0 asLongFloat abs


negated

return myself negated

rem: aNumber

return the floating point remainder of the receiver and the argument, aNumber

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

asFloat

return a Float with same value as the receiver.
Raises an error if the receiver exceeds the float range.

asInteger

return an integer with same value  might truncate
usage example(s):
12345.0 asLongFloat asInteger
1e15 asLongFloat asInteger


asLongFloat

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

asQuadFloat

return a QuadFloat with same value as the receiver

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


coerce: aNumber

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

generality

return the generality value  see ArithmeticValue>>retry:coercing:
comparing

< aNumber

return true, if the argument is greater

<= aNumber

return true, if the argument is greater or equal

= aNumber

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

> aNumber

return true, if the argument is less

>= aNumber

return true, if the argument is less or equal

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


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/comparingfloatingpointnumbers2012edition/
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


~= aNumber

return true, if the arguments value are not equal.
copying

deepCopy

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

deepCopyUsing: aDictionary postCopySelector: postCopySelector

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

shallowCopy

return a shallow copy of the receiver

simpleDeepCopy

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

productFromInteger: anInteger

sent when an integer does not know how to multiply the receiver, self

sumFromInteger: anInteger

sent when an integer does not know how to add the receiver, self
mathematical functions

exp

return e raised to the power of the receiver

ln

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

log10

return the base10 logarithm of the receiver.
Raises an exception, if the receiver is less or equal to zero.

raisedTo: aNumber

return self raised to the power of aNumber

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

printOn: aStream

append a printed representation of the receiver to
the argument, aStream.
I use #printString instead of #printOn: as basic print mechanism.

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 := $.


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)

printfPrintString: formatString

nonstandard: 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 Cprintf 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'


storeOn: aStream

append a printed representation of the receiver to
the argument, aStream.
I use #storeString instead of #storeOn: as basic store mechanism.

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 := $.

privateaccessing

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 nondouble 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.

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 nondouble 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.

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 nondouble 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.

byteAt: index


byteAt: index put: newByte

special access

exponent

extract a normalized float's exponent.
The returned value depends on the floatrepresentation 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


mantissa

extract a normalized float's mantissa.
The returned value depends on the floatrepresentation 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

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


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 Ccode 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


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 Ccode could produce them ...
usage example(s):
1.0 asLongFloat isNaN
(0.0 asLongFloat uncheckedDivide: 0.0) isNaN


isNegativeZero

many systems have two float.Pnt zeros
usage example(s):
0.0 asLongFloat isNegativeZero
0.0 asLongFloat isNegativeZero


isZero

return true, if the receiver is zero

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


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


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


strictlyPositive

return true if the receiver is greater than zero
trigonometric

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


arcCosh

return the hyperbolic arccosine of the receiver.
usage example(s):
10 asLongFloat arcCosh
1 asLongFloat arcCosh
0.5 asLongFloat arcCosh


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


arcSinh

return the hyperbolic arcsine of the receiver.
usage example(s):
10 asLongFloat arcSinh
1 asLongFloat arcSinh
0.5 asLongFloat arcSinh


arcTan

return the arctangent of the receiver (as radians)

arcTanh

return the hyperbolic arctangent of the receiver.

cos

return the cosine of the receiver (interpreted as radians)

cosh

return the hyperbolic cosine of the receiver

sin

return the sine of the receiver (interpreted as radians)

sinh

return the hyperbolic sine of the receiver

tan

return the tangens of the receiver (interpreted as radians)

tanh

return the hyperbolic tangens of the receiver
truncation & rounding

ceiling

return the smallest integer which is greater or equal to the receiver.
usage example(s):
0.5q ceiling
0.5q ceiling


ceilingAsFloat

return the smallest integervalued 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 floatoperation.
usage example(s):
0.5q ceilingAsFloat
0.5q ceilingAsFloat
1.5q ceilingAsFloat


floor

return the integer nearest the receiver towards negative infinity.
usage example(s):

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 intconversion.
usage example(s):
0.5q floorAsFloat
0.5q floorAsFloat
1.5q floorAsFloat


fractionPart

extract the afterdecimal 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


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


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 floatoperation.

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


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
floatoperation.
usage example(s):
0.5q truncated
0.5q truncated
0.5q truncatedAsFloat
0.5q truncatedAsFloat

