
Class: Float
Object

+Magnitude

+ArithmeticValue

+Number

+LimitedPrecisionReal

+Float
 Package:
 stx:libbasic
 Category:
 MagnitudeNumbers
 Version:
 rev:
1.281
date: 2019/07/22 18:16:59
 user: cg
 file: Float.st directory: libbasic
 module: stx stcclassLibrary: libbasic
 Author:
 Claus Gittinger
Floats represent rational numbers with limited precision.
They use the Ccompiler's 'double' format,
which is usually the 8byte IEEE double float format.
Floats give you 64 bit floats.
In contrast to ShortFloats (32bit) and LongFloats (>=64bit).
WARNING:
The layout of Float instances is known by the runtime system and the compiler;
you may not add instance variables here.
Also, subclassing is complicated by the fact, that the VM creates floats/shortFloats,
and does some floatchecks by an identity compare with the Floatclass.
(i.e. your subclasses instances may not be recognized as floatlike objects,
thus mixed mode arithmetic will always coerce them, effectively slowing things down).
Notice, that Floats are defined as Bytearray to prevent the garbage collector
from going into the value ... otherwise I needed a special case in many places.
Also notice, that ST/X Floats are what Doubles are in ST80. The reason for doing this
was to be compatible to both Digitalk, Squeak AND ParcPlace smalltalk implementations
(ParcPlace uses a 4byte Float and an 8byte Double class, in contrast to
Digitalk and Squeak, which have an 8byte Float class).
Thus, by providing an 8byte Float class, code would not loose precicion
(although some memory is wasted when porting from VW).
Notice that ST/X provides an alias called Double, and an extra ShortFloat class, which has 4byte
instances.
Mixed mode arithmetic:
float op float > float
float op fix > float
float op fraction > float
float op integer > float
float op shortFloat > float
float op longFloat > longFloat
float op complex > complex
Representation:
64bit double precision IEEE floats
52 bit mantissa + 1 hidden bit providing 53 bits of precision,
11 bit exponent,
15 decimal digits (approx.)
Range and Precision of Storage Formats: see LimitedPrecisionReal >> documentation
Number
ShortFloat
LongFloat
Fraction
FixedPoint
Integer
Complex
FloatArray
DoubleArray
accessing

defaultPrintFormat


defaultPrintFormat: something


defaultPrintfFormat


defaultPrintfFormat: something

binary storage

readBinaryIEEEDoubleFrom: aStream

read a float from the binary stream, aStream,
interpreting the next bytes as an IEEE formatted 8byte float.
The bytes are read in the native byte order (i.e.lsb on intel)

readBinaryIEEEDoubleFrom: aStream MSB: msbFirst

read a float from the binary stream, aStream,
interpreting the next bytes as an IEEE formatted 8byte float.
The bytes are read in the specified byte order

readBinaryIEEEDoubleFrom: aStream into: aBasicNewFloat

read the receiver's value from the binary stream, aStream,
interpreting the next bytes as an IEEE formatted 8byte float.
The bytes are read in the native byte order (i.e.lsb on intel)

readBinaryIEEEDoubleFrom: aStream into: aFloat MSB: msb

read the receiver's value from the binary stream, aStream,
interpreting the next bytes as an IEEE formatted 8byte float.
If msb is true, the stream bytes are mostsignificantfirst.

storeBinaryIEEEDouble: aFloat on: aStream

store aFloat as an IEEE formatted 8byte float
onto the binary stream, aStream.
The bytes are written in the native byte order (i.e.lsb on intel)

storeBinaryIEEEDouble: aFloat on: aStream MSB: msb

store aFloat as an IEEE formatted 8byte float
onto the binary stream, aStream.
If msb is true, the stream bytes are written mostsignificantfirst.
class initialization

initialize

print 15 valid digits
usage example(s):
Pi := nil.
self initialize

coercing & converting

coerce: aNumber

convert the argument aNumber into an instance of the receiver (class) and return it.
constants

NaN

return the constant NaN (not a Number)
usage example(s):
Float NaN
Float NaN + 0.0
Float NaN + Float NaN
0.0 + Float NaN
it's a singleton:
Float NaN == Float NaN


e

return the constant e as Float
usage example(s):
don't expect this many valid digits on all machines;

usage example(s):
The actual precision is very CPU specific.


emax

Answer the maximum exponent for this representation.

emin

Answer the minimum exponent for this representation.

halfpi

return the constant pi/2 as Float

halfpiNegative

return the constant pi/2 as Float

infinity

return a float which represents positive infinity (for my instances).
Warning: do not compare equal against infinities;
instead, check using isFinite or isInfinite
usage example(s):
Float infinity == Float infinity


ln10

return the natural logarithm of 10;
will return something like 2.30258509299405

ln2

return the natural logarithm of 2

maxSmallInteger

return the max. smallInteger value as a float

negativeInfinity

return a float which represents positive infinity (for my instances).
Warning: do not compare equal against infinities;
instead, check using isFinite or isInfinite
usage example(s):
Float negativeInfinity == Float negativeInfinity


pi

return the constant pi as Float

sqrt2

don't expect this many valid digits on all machines;

unity

return the neutral element for multiplication (1.0) as Float

zero

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

basicNew

return a new float  here we return 0.0
 floats are usually NOT created this way ...
Its implemented here to allow things like binary store & load
of floats. (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.

fastFromString: aString at: startIndex

return the next Float from the string starting at startIndex.
No spaces are skipped.
Raises an exception, if the startIndex is not valid.
Returns garbage if the argument string is not a valid double float number.
This is a specially tuned entry (using a lowlevel Ccall to atof).
It has been added to allow high speed string decomposition
into numbers, especially for massdata (reading millions of floats).
usage example(s):
Float fastFromString:'123.45' at:1
Float fastFromString:'123.45' at:2
Float fastFromString:'123.45' at:3
Float fastFromString:'123.45' at:4
Float fastFromString:'123.45' at:5
Float fastFromString:'123.45' at:6
Float fastFromString:'123.45E4' at:1
Float fastFromString:'hello123.45E4' at:6
Float fastFromString:'12345' at:1
Float fastFromString:'12345' at:2
Float fastFromString:'12345' at:3
Float fastFromString:'12345' at:4
Float fastFromString:'12345' at:5
Float fastFromString:'12345' at:6 > error
Float fastFromString:'12345' at:0 > error
Float fastFromString:'hello123.45E4' at:1 > 0
Float fastFromString:'1.7976931348623157e+308'
Float fastFromString:'Nan'
Float fastFromString:'+Inf'
Float fastFromString:'Inf'

usage example(s):
Time millisecondsToRun:[
1000000 timesRepeat:[
Float fastFromString:'123.45' at:1
]
]


fromIEEE32Bit: anInteger

creates a double, given the four native float bytes as an integer
usage example(s):
ShortFloat fromIEEE32Bit:((ShortFloat pi digitBytesMSB:true) asIntegerMSB:true)


fromIEEE64Bit: anInteger

creates a double, given the eight native double bytes as an integer
usage example(s):
Float fromIEEE64Bit:((Float pi digitBytesMSB:true) asIntegerMSB:true)


fromInteger: anInteger

return a new float, given an integer value
usage example(s):
Float fromInteger:123
Float fromInteger:(100 factorial)
(100 factorial) asFloat


fromNumber: aNumber

return aNumber coerced to Float

fromVAXFloatBytes: b1 b2: b2 b3: b3 b4: b4

creates a double, given the four vax Fformat float bytes to an ieee double.
For NaNs and Infinity, nil is returned.
To get an idea of how big the floatingpoint zoo really is,
see: http://www.quadibloc.com/comp/cp0201.htm
misc

getFPUControl

BORLAND only: get the fpu control word.
usage example(s):

setFPUControl

BORLAND only: set the fpu control word for 64 bit precision for long doubles here
usage example(s):
queries

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
This is an IEEE float, where 11 bits are available:
seeeeeee eeeemmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
usage example(s):

numBitsInMantissa

answer the number of bits in the mantissa.
This is an IEEE double, where 52 bits (the hidden one is not counted here) are available:
seeeeeee eeeemmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm

precision

answer the precision (the number of bits in the mantissa) of a Float (in bits)
This is an IEEE double, where only the fraction from the normalized mantissa is stored
and so there is a hidden bit and the mantissa is actually represented
by 53 binary digits (although only 52 are needed in the binary representation)
usage example(s):
self numBitsInMantissa + 1
self precision


radix

answer the radix of a Float'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):

negated

return the receiver 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 uncheckedDivide:0.0
1.0 uncheckedDivide:0.0
1.0 uncheckedDivide:0.0

coercing & converting

asDouble

ST80 compatibility: return a double with the receiver's value.
In ST/X, floats are the equivalent to ST80 doubles

asFloat

return a Float with same value  that's me

asInteger

return an integer with same value  might truncate
usage example(s):
usage example(s):

asLongFloat

return a LongFloat with same value as receiver
usage example(s):

asQDouble
( an extension from the stx:libbasic2 package )

return a QDouble with my value
usage example(s):

asQuadFloat

return a quadFloat with same value as receiver
usage example(s):
123 asFloat asQuadFloat
0 asFloat asQuadFloat
0.0 asQuadFloat


asShortFloat

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

asTrueFraction

Answer a fraction or integer that EXACTLY represents the receiver,
a double precision IEEE floating point number.
Floats are stored in the same form on all platforms.
(Does not handle gradual underflow or NANs.)
By David N. Smith with significant performance
improvements by Luciano Esteban Notarfrancesco.
(Version of 11April97)
usage example(s):
(result asFloat = self) ifFalse: [self error: 'asTrueFraction validation failed'].

usage example(s):
0.3 asTrueFraction  as you can see, Float is not able to represent this exactly
1.25 asTrueFraction  but this one (it is a sum of powers of two)
0.25 asTrueFraction
0.25 asTrueFraction
3e37 asTrueFraction
2e37 asTrueFraction
1e37 asTrueFraction
1e30 asTrueFraction
Float NaN asTrueFraction
Float infinity asTrueFraction


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):
mhmh take some of my valuebits to hash on

usage example(s):
3 hash
3.0 hash
3.1 hash
3.14159 hash
31.4159 hash
3.141591 hash
1.234567890123456 hash
1.234567890123457 hash
Set withAll:#(3 3.0 99 99.0 3.1415)


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.
That is an integer, which counts the deltasteps in the mantissa.
Notice, that the absolute value of the epsilon depends on the receiver
(i.e. with a receiver of 10^17, a mantissastep is much larger than with 10^17 as receiver)
For background information why floats need this
read: http://randomascii.wordpress.com/2012/02/25/comparingfloatingpointnumbers2012edition/
usage example(s):
67329.234 isAlmostEqualTo:67329.23400000001 nEpsilon:1
1.0 isAlmostEqualTo:1.0001 nEpsilon:1
1.0 isAlmostEqualTo:1.0 nEpsilon:1
1 isAlmostEqualTo:1.000000000000001 nEpsilon:1
1 isAlmostEqualTo:1.000000000000001 nEpsilon:10
1.0 isAlmostEqualTo:1 nEpsilon:1
1.0 isAlmostEqualTo:1 asFraction nEpsilon:1
0.0 isAlmostEqualTo:0 nEpsilon:1
0.0 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
mathematical functions

cbrt

return the cubic root of myself.
usage example(s):

exp

return e raised to the power of the receiver

ldexp: exp

multiply the receiver by an integral power of 2.
I.e. return self * (2 ^ exp)
usage example(s):

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):
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;
if not specified otherwise (by setting DefaultPrintFormat),
6 valid digits are printed.
LimitedPrecisonReal and its subclasses use #printString instead of
#printOn: as basic print mechanism.
usage example(s):
Float pi printString.
1.0 printString
1.234 printString
1e10 printString
1e60 printString
1.2e3 printString
1.2e30 printString
(1.0 uncheckedDivide:0) printString
(0.0 uncheckedDivide:0) printString
self pi printString.
DecimalPointCharacter := $,.
1.234 printString.
1.0 printString.
1e10 printString.
1.2e3 printString.
1.2e30 printString.
(1.0 uncheckedDivide:0) printString.
(0.0 uncheckedDivide:0) printString.
DecimalPointCharacter := $.


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 doubles differs on
systems; on SYSV machines you have to give something like %lf,
while on BSD systems the format string has to be %F.
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 printfPrintString:'%%lg > %lg'
Float pi printfPrintString:'%%lf > %lf'
Float pi printfPrintString:'%%7.15lg > %7.15lg'
Float pi printfPrintString:'%%7.5lf > %7.5lf'
Float pi printfPrintString:'%%G > %G'
Float pi printfPrintString:'%%F > %F'
Float pi printfPrintString:'%%7.5G > %7.5G'
Float pi printfPrintString:'%%7.5F > %7.5F'
Float pi printfPrintString:'%%7.5f > %7.5f'
Float pi printfPrintString:'%%100.98f > %100.98f'
Float pi printfPrintString:'%%100.6f > %100.6f'
Float pi printfPrintString:'%%300.6f > %300.6f'
Float pi printfPrintString:'%%100.98f > %100.98f'
Float pi printfPrintString:'%%300.298f > %300.298f'
Float pi printfPrintString:'%%300.298f > %300.298f'
Float pi printfPrintString:'%%100.6f > <%100.6f>'
Float pi printfPrintString:'%%300.6f > <%300.6f>'
Float pi printfPrintString:'%%100.6f > <%100.6>'
Float pi printfPrintString:'%%300.6f > <%300.6>'


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 storeString
0.1 storeString
((Array new:10 withAll:0.1) inject:0 into:[:v :sumSoFar sumSoFar + v]) storeString
1.234 storeString
1e10 storeString
1.2e3 storeString
1.2e30 storeString
Float pi storeString
(1.0 uncheckedDivide:0) storeString
(0.0 uncheckedDivide:0) storeString
notice that the storeString is NOT affected by DecimalPointCharacterForPrinting:
DecimalPointCharacterForPrinting := $,.
1.234 storeString.
1.0 storeString.
1e10 storeString.
1.2e3 storeString.
1.2e30 storeString.
(1.0 uncheckedDivide:0) storeString.
(0.0 uncheckedDivide:0) storeString.
DecimalPointCharacterForPrinting := $.

private

absDecimalPrintOn: aStream digits: digits
( an extension from the stx:libbasic2 package )

Place a string representation of the receiver's abs value
on <aStream> using <digits> significant digits, using decimal notation.
This is a helper for printf.
** This is an obsolete interface  do not use it (it may vanish in future versions) **

absPrintOn: aStream digits: digits
( an extension from the stx:libbasic2 package )

Place a string representation of the receiver's abs value on <aStream> using
<digits> significant digits.
This is a helper for printf.
** This is an obsolete interface  do not use it (it may vanish in future versions) **

absScientificPrintOn: aStream digits: digits
( an extension from the stx:libbasic2 package )

Place a string representation of the receiver's abs value on <aStream> using <digits> significant
digits, using scientific notation.
This is a helper for printf.
** This is an obsolete interface  do not use it (it may vanish in future versions) **
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 4 bytes of a float are left unused,
and the actual float is stored at index 5 .. 12.
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 4 bytes of a float are left unused,
and the actual float is stored at index 5 .. 12.
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 4 bytes of a float are left unused,
and the actual float is stored at index 5 .. 12.
To hide this at one place, this method knows about that, and returns
values as if this filler wasn't present.

byteAt: index


byteAt: index put: newByte

queries

nextFloat: count

answer the next float count places after (or before if count is negative) myself
usage example(s):
(1.0 nextFloat:1) storeString
(67329.234 nextFloat:1) storeString
(67329.234 asShortFloat nextFloat:1) storeString
Float NaN nextFloat:100000
Float infinity nextFloat:100000

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):
1.0 exponent
2.0 exponent
3.0 exponent
4.0 exponent
0.5 exponent
0.4 exponent
0.25 exponent
0.2 exponent
0.00000011111 exponent
0.0 exponent
1e1000 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.0 exponent
1.0 mantissa
0.25 exponent
0.25 mantissa
0.00000011111 exponent
0.00000011111 mantissa
1e1000 mantissa

testing

isFinite

return true, if the receiver is a finite float
i.e. not NaN and not infinite.
usage example(s):
1.0 isFinite
self NaN isFinite
self infinity isFinite
(0.0 uncheckedDivide: 0.0) isFinite
(1.0 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 isInfinite
(0.0 uncheckedDivide: 0.0) isInfinite
(1.0 uncheckedDivide: 0.0) isInfinite
(1.0 uncheckedDivide: 0.0) isInfinite


isLiteral

return true, if the receiver can be used as a literal constant in ST syntax
(i.e. can be used in constant arrays)

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):
self NaN isNaN
1.0 isNaN
(0.0 uncheckedDivide: 0.0) isNaN
(1.0 uncheckedDivide: 0.0) isNaN
(1.0 uncheckedDivide: 0.0) isNaN


isNegativeZero

many systems have two float.Pnt zeros
usage example(s):
0.0 isNegativeZero
0.0 isNegativeZero
1.0 isNegativeZero
1.0 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 negative
0.0 negative
1.0 negative
1.0 negative
(1.0 uncheckedDivide: 0.0) negative
(1.0 uncheckedDivide: 0.0) negative


numberOfBits

return the size (in bits) of the real;
typically, 64 is returned here,
but who knows ...
usage example(s):
1.2 numberOfBits
1.2 asShortFloat 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 positive
0.0 positive
1.0 positive
1.0 positive
(1.0 uncheckedDivide: 0.0) positive
(1.0 uncheckedDivide: 0.0) positive


strictlyPositive

return true if the receiver is greater than zero
tracing

traceInto: aRequestor level: level from: referrer

double dispatch into tracer, passing my type implicitely in the selector
trigonometric

arcCos

return the arccosine of the receiver (as radians).
Raises an exception, if the receiver is not in 1..1
usage example(s):

arcCosh

return the hyperbolic arccosine of the receiver.
usage example(s):
10.0 arcCosh
1.0 arcCosh


arcSin

return the arcsine of myself (I am interpreted as radians).
Raises an exception, if the receiver is not in 1..1
usage example(s):

arcSinh

return the hyperbolic arcsine of the receiver.
usage example(s):
10.0 arcSinh
1.0 arcSinh


arcTan

return the arctangent of the receiver (as radians)

arcTan2: x

return the atan2(self,x)

arcTan: denominator

Evaluate the four quadrant arc tangent of the argument denominator (x) and the receiver (y).

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.

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.5 ceilingAsFloat
0.5 ceilingAsFloat
1.5 ceilingAsFloat


floor

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


floorAsFloat

return the integer nearest the receiver towards negative infinity as a float.
This is much like #floor, 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.5 floor
0.5 floorAsFloat
0.5 floor
0.5 floorAsFloat


fractionPart

extract the afterdecimal fraction part.
such that (self truncated + self fractionPart) = self
usage example(s):
1.6 fractionPart + 1.6 truncated
1.6 fractionPart + 1.6 truncated
1.0 fractionPart
2.0 fractionPart
3.0 fractionPart
4.0 fractionPart
0.5 fractionPart
0.25 fractionPart
3.14159 fractionPart
12345673.14159 fractionPart
123456731231231231.14159 fractionPart
3.14159 fractionPart + 3.14159 truncated
12345673.14159 fractionPart + 12345673.14159 truncated
123456731231231231.14159 fractionPart + 123456731231231231.14159 truncated


rounded

return the receiver rounded to the nearest integer
usage example(s):
0.4 rounded
0.5 rounded
0.6 rounded
0.4 rounded
0.5 rounded
0.6 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.
usage example(s):
0.5 rounded
0.5 rounded
0.5 roundedAsFloat
0.5 roundedAsFloat


truncated

return the receiver truncated towards zero as an integer
usage example(s):
0.5 truncated
0.5 truncated
0.5 truncatedAsFloat
0.5 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.5 truncated
0.5 truncated
0.5 truncatedAsFloat
0.5 truncatedAsFloat

