eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Number':

Home

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

Class: Number


Inheritance:

   Object
   |
   +--Magnitude
      |
      +--ArithmeticValue
         |
         +--Number
            |
            +--Fraction
            |
            +--Integer
            |
            +--LimitedPrecisionReal
            |
            +--MeasurementValue
            |
            +--MetaNumber

Package:
stx:libbasic
Category:
Magnitude-Numbers
Version:
rev: 1.224 date: 2018/05/10 13:44:17
user: cg
file: Number.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger

Description:


abstract superclass for all kinds of numbers

[class variables:]
    DecimalPointCharacterForPrinting          <Character>                     used when printing
    DecimalPointCharactersForReading          <Collection of Character>       accepted as decimalPointChars when reading

    DefaultDisplayRadix     the radix in which integers present their
                            displayString (which is used in inspectors)
                            If you are to look at many hex numbers, bitmasks
                            etc. you may set this to 2 or 16.
                            (avoids typing printStringRadix:.. all the time
                             - I know - I am lazy ;-). Default is 10.


Related information:

    Integer
    LargeInteger
    SmallInteger
    LimitedPrecisionReal
    Float
    ShortFloat
    Fraction
    FixedPoint

Class protocol:

Compatibility-VW
o  readIntegerFrom: aStream radix: radix
for VisualWorks compatibility

Javascript support
o  MAX_VALUE
( an extension from the stx:libjavascript package )
in expecco/stx-JS, there is no MAX_VALUE;
return something useful (simulate 64bits)
usage example(s):
     JavaScriptParser
	evaluate:'Number.MAX_VALUE;'

o  MIN_VALUE
( an extension from the stx:libjavascript package )
in expecco/stx-JS, there is no MIN_VALUE;
return something useful (simulate 64bits)
usage example(s):
     JavaScriptParser
        evaluate:'Number.MIN_VALUE;'

o  NEGATIVE_INFINITY
( an extension from the stx:libjavascript package )
return the special 'negative infinity' value
usage example(s):
     JavaScriptParser
	evaluate:'Number.NEGATIVE_INFINITY;'

o  NaN
( an extension from the stx:libjavascript package )
return the special 'not a number' value
usage example(s):
     JavaScriptParser
	evaluate:'Number.NaN;'

o  POSITIVE_INFINITY
( an extension from the stx:libjavascript package )
return the special 'positive infinity' value
usage example(s):
     JavaScriptParser
	evaluate:'Number.POSITIVE_INFINITY;'

o  js_new: argument
( an extension from the stx:libjavascript package )
JavaScriptParser
evaluate:'new Number(100)'

JavaScriptParser
evaluate:'new Error(''hello'')'

constants
o  e
return the closest approximation of the irrational number e

** This method raises an error - it must be redefined in concrete classes **

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

** This method raises an error - it must be redefined in concrete classes **

o  epsilonForCloseTo
return the epsilon used in the closeTo: comparison.
(useful would be something like self epsilon or epsilon*10,
but for Squeak compatibility.... - sigh)

o  i
return the imaginary unit i
usage example(s):
     1 + Number i          -> (1+1i)
     Number i + 10         -> (10+1i)
     Number i * Number i   -> -1
usage example(s):
Modified (comment): / 22-09-2017 / 09:53:14 / cg

o  ln10
return ln(10) in my representation (and accuracy).

** This method raises an error - it must be redefined in concrete classes **

o  pi
return Pi in my representation (and accuracy).

** This method raises an error - it must be redefined in concrete classes **

constants & defaults
o  decimalPointCharacter
printed

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  decimalPointCharacter: aCharacter
printed

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  decimalPointCharacterForPrinting
printed

o  decimalPointCharacterForPrinting: aCharacter
printed
usage example(s):
     1.5 printString

     Number decimalPointCharacterForPrinting:$,.
     1.5 printString
     Number decimalPointCharacterForPrinting:$..

o  decimalPointCharacters
accepted when converting from a string

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  decimalPointCharacters: aCollectionOfCharacters
accepted when converting from a string

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  decimalPointCharactersForReading
default when converting from a string
usage example(s):
     1.5 printString

     Number decimalPointCharactersForReading:#( $. $,) .
     Number fromString:'1.5'.
     Number fromString:'1,5'.
     Number decimalPointCharactersForReading:#( $. ).

o  decimalPointCharactersForReading: aCollectionOfCharacters
accepted when converting from a string
usage example(s):
     Number decimalPointCharactersForReading:#( $. $,) .
     Number fromString:'1.5'.
     Number fromString:'1,5'.
     Number decimalPointCharactersForReading:#( $. ).

error reporting
o  raise: aSignalSymbolOrErrorClass receiver: someNumber selector: sel arg: arg errorString: text
ST-80 compatible signal raising. Provided for PD numeric classes
usage example(s):
     Number
	raise:#domainErrorSignal
	receiver:1.0
	selector:#sin
	arg:nil
	errorString:'foo bar test'

o  raise: aSignalSymbolOrErrorClass receiver: someNumber selector: sel errorString: text
ST-80 compatible signal raising. Provided for PD numeric classes.
aSignalSymbolOrErrorClass is either an Error-subclass, or
the selector which is sent to myself, to retrieve the Exception class / Signal.
usage example(s):
     Number
	raise:#domainErrorSignal
	receiver:1.0
	selector:#foo
	errorString:'foo bar test'

instance creation
o  coerce: aNumber
convert the argument aNumber into an instance of the receiver (class) and return it.

o  fastFromString: aString
return the next Float, Integer or ShortFloat from the string.
No spaces are skipped.

This is a specially tuned entry (using a low-level C-call), which
returns garbage if the argument string is not a valid float number.
It has been added to allow high speed string decomposition into numbers,
especially for mass-data.
usage example(s):
     Float fromString:'12345.0'
     Float fastFromString:'12345.0'

     Integer fromString:'12345'
     Integer fastFromString:'12345'

     should be roughly 10times faster than the general method:

     Time millisecondsToRun:[
	100000 timesRepeat:[ Float fromString:'12345.0' ]
     ].
     Time millisecondsToRun:[
	100000 timesRepeat:[ Float fastFromString:'12345.0' ]
     ].

     Time millisecondsToRun:[
	100000 timesRepeat:[ Integer fromString:'12345' ]
     ].
     Time millisecondsToRun:[
	100000 timesRepeat:[ Integer fastFromString:'12345' ]
     ].

o  fromNumber: aNumber
return aNumber coerced to myself

o  fromString: aString
return a number by reading from aString.
In contrast to readFrom:, no garbage is allowed after the number.
I.e. the string must contain exactly one valid number (with optional separators around)
usage example(s):
     Number fromString:'12345'
     Number fromString:'abc'
     Number fromString:'1abc'   -> raises an error
     Number readFrom:'1abc'     -> reads a 1
     Number readFrom:'10/2'     -> reads a 10
     Number fromString:'10/2'   -> raises an error
     Number fromString:'(1/2)'  -> reads a fraction
     Number readFrom:'(1/2)'    -> reads a fraction
     Number readFrom:'(10/2)'   -> reads a 5
     '12345' asNumber

o  fromString: aString decimalPointCharacters: decimalPointCharacters
return a number by reading from aString.
In contrast to readFrom:, no garbage is allowed after the number.
I.e. the string must contain exactly one valid number (with optional separators around)
usage example(s):
     Number fromString:'12345'
     Number fromString:'abc'
     Number fromString:'1abc'
     '12345' asNumber

o  fromString: aString decimalPointCharacters: decimalPointCharacters onError: exceptionBlock
return a number by reading from aString.
In contrast to readFrom:, no garbage is allowed after the number.
I.e. the string must contain exactly one valid number (with optional separators around)
usage example(s):
     Number fromString:'12345' onError:0
     Number fromString:'12,345' decimalPointCharacters:',' onError:0
     Number fromString:'12,345' decimalPointCharacters:',' onError:0
     Number fromString:'fooBarBaz' onError:0
     Number fromString:'123fooBarBaz' onError:0
     Number fromString:'123,fooBarBaz' decimalPointCharacters:',' onError:0

o  fromString: aString onError: exceptionBlock
return a number by reading from aString.
In contrast to readFrom:, no garbage is allowed after the number.
I.e. the string must contain exactly one valid number (with optional separators around)
usage example(s):
     Number fromString:'12345' onError:0
     Number fromString:'fooBarBaz' onError:0
     Number fromString:'123fooBarBaz' onError:0

o  readFrom: aStringOrStream decimalPointCharacters: decimalPointCharacters
return the next Number from the (character-)stream aStream;
skipping all whitespace first.
Return the value of exceptionBlock, if no number can be read.
This method is less strict than the smalltalk number reader; it
allows for prefixed + and also allows missing fractional part after eE.
It also allows garbage after the number - i.e. it reads what it can.
See #fromString: , which is more strict and does not allow garbage at the end.
usage example(s):
     Number readFrom:'123.456' decimalPointCharacters:'.'
     Number readFrom:'123,456' decimalPointCharacters:'.,'
     Number readFrom:'123,456' decimalPointCharacters:'.'

o  readFrom: aStringOrStream decimalPointCharacters: decimalPointCharacters onError: exceptionBlock
return the next Number from the (character-)stream aStream;
skipping all whitespace first.
Return the value of exceptionBlock, if no number can be read.
This method is less strict than the smalltalk number reader; it
allows for prefixed + and also allows missing fractional part after eE.
It also allows garbage after the number - i.e. it reads what it can.
See #fromString: , which is more strict and does not allow garbage at the end.

Notice (see examples below):
if sent to Number, it will decide which type of number to return (depending on the exponent character);
if sent to a concrete number-class, an instance of that class will be returned (independent of the exponent character)

usage example(s):
value := super readFrom:str.
usage example(s):
     Number readFrom:(ReadStream on:'54.32e-01') decimalPointCharacters:'.' onError:[self halt].

     Number readFrom:(ReadStream on:'12345') decimalPointCharacters:'.' onError:[self halt].
     Number readFrom:(ReadStream on:'12345.0') decimalPointCharacters:'.' onError:[self halt].
     
     Number readFrom:(ReadStream on:'12345.0f') decimalPointCharacters:'.' onError:[self halt].
     Number readFrom:(ReadStream on:'12345.0e') decimalPointCharacters:'.' onError:[self halt].
     Number readFrom:(ReadStream on:'12345.0q') decimalPointCharacters:'.' onError:[self halt].
     Number readFrom:(ReadStream on:'12345.0d') decimalPointCharacters:'.' onError:[self halt].
     Number readFrom:(ReadStream on:'12345.0s') decimalPointCharacters:'.' onError:[self halt].
     Number readFrom:(ReadStream on:'12345.01s') decimalPointCharacters:'.' onError:[self halt].

     Float readFrom:(ReadStream on:'12345') decimalPointCharacters:'.' onError:[self halt].
     
     Number readFrom:(ReadStream on:'12345678901234567890')
     Number readFrom:(ReadStream on:'12345678901234567890.0')
     Number readFrom:(ReadStream on:'12345678901234567890.012345678901234567890')
     Number readFrom:(ReadStream on:'16rAAAAFFFFAAAAFFFF')
     Number readFrom:'16rAAAAFFFFAAAAFFFF'
     Number readFrom:'0.000001'
     '+00000123.45' asNumber
     Number readFrom:'(1/3)'
     Number readFrom:'(-1/3)'
     Number readFrom:'(1/-3)'
     Number readFrom:'-(1/3)'
     Number readFrom:'-(-1/3)'
     Number readFrom:'(-1/3'
     Number readFrom:'99s'
     Number readFrom:'99.00s'
     Number readFrom:'99.0000000s'
     Number readFrom:'.0000000s'
     Number readFrom:'.0000000q'
     Number readFrom:'.0000000f'
     Number readFrom:'.0000000e'
     Number readFrom:'.0000000s1'
     Number readFrom:'.0000000q1'
     Number readFrom:'.0000000f1'
     Number readFrom:'.0000000e1'
     LongFloat readFrom:'.00000001'
     Number readFrom:'.00000000000001'
     Number readFrom:'.001'
     ShortFloat readFrom:'.001'
     Number readFrom:'123garbage'      -> returns 123
     Number fromString:'123garbage'    -> raises an error

     DecimalPointCharactersForReading := #( $. $, ).
     Number readFrom:'99,00'

     DecimalPointCharactersForReading := #( $. ).
     Number readFrom:'99,00'

o  readFrom: aStringOrStream onError: exceptionBlock
return the next Number from the (character-)stream aStream;
skipping all whitespace first; return the value of exceptionBlock,
if no number can be read.
This method is less strict than the smalltalk number reader; it
allows for prefixed + and also allows missing fractional part after eE.
It also allows garbage after the number - i.e. it reads what it can.
See #fromString: , which is more strict and does not allow garbage at the end.
usage example(s):
     Number readFrom:(ReadStream on:'54.32e-01')
     Number readFrom:(ReadStream on:'12345678901234567890')
     Number readFrom:(ReadStream on:'12345678901234567890.0')
     Number readFrom:(ReadStream on:'12345678901234567890.012345678901234567890')
     Number readFrom:(ReadStream on:'16rAAAAFFFFAAAAFFFF')
     Number readFrom:'16rAAAAFFFFAAAAFFFF'
     Number readFrom:'0.000001'
     '+00000123.45' asNumber
     Number readFrom:'99s'
     Number readFrom:'99.00s'
     Number readFrom:'99.0000000s'
     Number readFrom:'.0000000s'
     Number readFrom:'.0000000q'
     Number readFrom:'.0000000f'
     Number readFrom:'.0000000e'
     Number readFrom:'.0000000s1'
     Number readFrom:'.0000000q1'
     Number readFrom:'.0000000f1'
     Number readFrom:'.0000000e1'

     DecimalPointCharactersForReading := #( $. $, ).
     Number readFrom:'99,00'

     DecimalPointCharactersForReading := #( $. ).
     Number readFrom:'99,00'

o  readSmalltalkSyntaxFrom: aStream
ST-80 compatibility (thanks to a note from alpha testers)
read and return the next Number in smalltalk syntax from the
(character-) aStream.
Returns nil if aStream contains no valid number.
usage example(s):
     Number readSmalltalkSyntaxFrom:'99d'
     Number readSmalltalkSyntaxFrom:'99.00d'
     Number readSmalltalkSyntaxFrom:'54.32e-01'
     Number readSmalltalkSyntaxFrom:'12345678901234567890'
     Number readSmalltalkSyntaxFrom:'16rAAAAFFFFAAAAFFFF'
     Number readSmalltalkSyntaxFrom:'foobar'
     Number readSmalltalkSyntaxFrom:'(1/10)'

     Number readSmalltalkSyntaxFrom:'(1/0)'

     Number readFrom:'(1/3)'
     Number readFrom:'(-1/3)'
     Number readFrom:'-(1/3)'
     Number readFrom:'(1/-3)'
     Number readFrom:'(-1/-3)'
     Number readFrom:'-(-1/-3)'
     Number readSmalltalkSyntaxFrom:'+00000123.45'
     Number readFrom:'+00000123.45'

     |s|
     s := ReadStream on:'2.'.
     Number readSmalltalkSyntaxFrom:s.
     s next

     |s|
     s := ReadStream on:'2.0.'.
     Number readSmalltalkSyntaxFrom:s.
     s next

o  readSmalltalkSyntaxFrom: aStream onError: errorValue
ST-80 compatibility (thanks to a note from alpha testers)
read and return the next Number in smalltalk syntax from the
(character-) aStream.
Returns nil if aStream contains no valid number.
usage example(s):
     Number readSmalltalkSyntaxFrom:'foo' onError:123

misc
o  displayRadix: aNumber
being tired of always sending #printStringRadix: in the inspectors,
this allows you to change the default print radix for the displayString
method.
usage example(s):
     Integer displayRadix:16. 123456 inspect
     Integer displayRadix:10. 123456 inspect

private
o  readMantissaAndScaleFrom: aStream radix: radix
helper for readFrom: -
return the mantissa (post-decimal-point digits) from the (character-)stream aStream;
in addition, the mantissa as integer and the scale (number of postDecimalPoint digits) is returned
(both to support reading fixedPoint numbers and to not loose precision).
The integer mantissa is needed as we do not yet know the target type (could be LongFloat or even QDouble).
No whitespace is skipped.
usage example(s):
     Number readMantissaAndScaleFrom:'234'    readStream radix:10.
     Number readMantissaAndScaleFrom:'2'      readStream radix:10.
     Number readMantissaAndScaleFrom:'234567' readStream radix:10.
     Number readMantissaAndScaleFrom:'234000' readStream radix:10.
     Number readMantissaAndScaleFrom:'234'    readStream radix:10.
     Number readMantissaAndScaleFrom:'000234' readStream radix:10.
     Number readMantissaAndScaleFrom:'01' readStream radix:10.
     Number readMantissaAndScaleFrom:'001' readStream radix:10.
     Number readMantissaAndScaleFrom:'0001' readStream radix:10.
     Number readMantissaAndScaleFrom:'000000000000000000000000000024' readStream radix:10.
     Number readMantissaAndScaleFrom:'0000000000000000000000000000000000000000000024' readStream radix:10.
     Number readMantissaAndScaleFrom:'123456789012345678901234567890' readStream radix:10.

     Number readMantissaAndScaleFrom:'12345678901234567890' readStream radix:10.

o  readMantissaFrom: aStream radix: radix
helper for readFrom: -
return the mantissa (post-decimal-point digits)
from the (character-)stream aStream;
No whitespace is skipped.
usage example(s):
     Number readMantissaFrom:'234'    readStream radix:10.
     Number readMantissaFrom:'2'      readStream radix:10.
     Number readMantissaFrom:'234567' readStream radix:10.

queries
o  isAbstract
Return if this class is an abstract class.
True is returned for Number here; false for subclasses.
Abstract subclasses must redefine this again.


Instance protocol:

Compatibility-Squeak
o  asDuration
( an extension from the stx:libcompat package )
return an TimeDuration object from the receiver, taking the receiver
as number of seconds

o  asSmallAngleDegrees
Return the receiver normalized to lie within the range (-180, 180)
usage example(s):
     #(-500 -300 -150 -5 0 5 150 300 500 1200)
	collect: [:n | n asSmallAngleDegrees]

o  closeFrom: aNumber
are these two numbers close?

o  closeFrom: aNumber withEpsilon: eps
are these two numbers close?

o  closeTo: num
are these two numbers close to each other?
usage example(s):
     1 closeTo:1.0000000001
     1 closeTo:1.001
     1 closeTo:1.001 withEpsilon:0.001

o  closeTo: num withEpsilon: eps
are these two numbers close to each other?
usage example(s):
     1 closeTo:1.0000000001
     1 closeTo:1.001

     1 closeTo:1.001 withEpsilon:0.1
     1 closeTo:1.201 withEpsilon:0.1

     3.14 closeTo:(3.14 asFixedPoint:2)
     (3.14 asFixedPoint:2) closeTo:3.14

o  degreeCos
Return the cosine of the receiver taken as an angle in degrees.

o  degreeSin
Return the sine of the receiver taken as an angle in degrees.

o  degreeTan
Return the cosine of the receiver taken as an angle in degrees.

o  isEqual: aNumber within: accuracy

o  newTileMorphRepresentative
( an extension from the stx:libcompat package )

o  rounded: n
Answer the float rounded with n digits of precision
usage example(s):
     7 rounded:2
     7.1 rounded:2
     7.2345 rounded:2
     7.2385 rounded:2
     7.2341 rounded:3
     7.2345 rounded:3
     7.2348 rounded:3

o  sqrtWithErrorLessThan: epsilon
compute the square root, using the Newton method.
The approximated return value has an error less than the given epsilon.
usage example(s):
     (2 asFixedPoint:4) sqrtWithErrorLessThan:0.001

o  stringForReadout
( an extension from the stx:libcompat package )

Javascript support
o  toExponential: nDigits
( an extension from the stx:libjavascript package )
return a string representing the number in exponential notation

o  toExponential: nDigits _: nDigitsAfter
( an extension from the stx:libjavascript package )
return a string representing the number in exponential notation

o  toFixed: nDigits
( an extension from the stx:libjavascript package )
return a string representing the number in fixed notation

o  typeof
( an extension from the stx:libjavascript package )
return a string describing what I am
usage example(s):
     JavaScriptParser
	evaluate:'''hello''.typeof()'

     JavaScriptParser
	evaluate:'1234.typeof();'

     JavaScriptParser
	evaluate:'typeof (1234)'

     JavaScriptParser
	evaluate:'typeof 1234'

coercing & converting
o  i
return a complex number, with the receiver as imaginary part, 0 as real part
usage example(s):
     3i     -> (0+3i)
     (1+1i) -> (1+1i)
usage example(s):
Modified (format): / 22-09-2017 / 09:53:27 / cg

comparing
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. See documentation in LimitedPrecisionReal for more detail.

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

o  isAlmostEqualTo: aNumber withError: errFraction
return true, if the receiver,is inside the interval aNumber-err .. aNumber+err.
Err is a fraction of 0..1.
usage example(s):
     within 10%?
     10.5 isAlmostEqualTo:10 withError:0.1

     within 1%
     10.5 isAlmostEqualTo:10 withError:0.01

converting
o  % aNumber
Return a complex number with the receiver as the real part and
aNumber as the imaginary part

o  +/- anError
return a MeasurementValue with a given error.
usage example(s):
     (100 +/- 5) * 2
     (100 +/- 5) * (100 +/- 10)
     (100 +/- 5) + (100 +/- 10)
     (100 +/- 5) - (100 +/- 10)

o  @ aNumber
return a Point with the receiver as x-coordinate and the argument
as y-coordinate

o  asComplex
Return a complex number with the receiver as the real part and
zero as the imaginary part

o  asMetaNumber
Float NaN asMetaNumber
Float infinity asMetaNumber
Float negativeInfinity asMetaNumber

o  asNumber
I am a number, so return myself

o  asPercentFrom: fullAmount
what is the percentage
taking the receiver's value from the argument
usage example(s):
     20 asPercentFrom:100
     (10 asPercentFrom:156) asFixedPoint:2
     (15.6 asPercentFrom:156) asFixedPoint:2

o  asPoint
return a new Point with the receiver as all coordinates;
often used to supply the same value in two dimensions, as with
symmetrical gridding or scaling.

o  asTimeDuration
return an TimeDuration object from the receiver, taking the receiver
as number of seconds
usage example(s):
     5 asTimeDuration
     50.25 asTimeDuration
     3600 asTimeDuration

o  degreesToRadians
interpreting the receiver as degrees, return the radians
usage example(s):
     180 degreesToRadians
     Float pi radiansToDegrees

o  literalArrayEncoding
encode myself as an array literal, from which a copy of the receiver
can be reconstructed with #decodeAsLiteralArray.

o  percentOf: hundredPercent
how many is self-percent from the argument
usage example(s):
     20 percentOf:100
     (10 percentOf:156) asFixedPoint:2
     (105 percentOf:156) asFixedPoint:2

o  radiansToDegrees
interpreting the receiver as radians, return the degrees
usage example(s):
     180 degreesToRadians
     Float pi radiansToDegrees

o  withScale: newScale
return a fixedPoint number representing the same value as the receiver,
with newScale number of post-decimal digits
usage example(s):
     1234 withScale:2
     1234.1 withScale:2
     1234.12 withScale:2
     1234.123 withScale:2
     (1/7) withScale:2

converting-times
o  days
return a TimeDuration representing this number of days
usage example(s):
     1000 milliseconds
     10 seconds
     10 minutes
     1 days

o  hours
return a TimeDuration representing this number of hours

o  microseconds
return a TimeDuration representing this number of microseconds.
usage example(s):
     40 microseconds

o  milliSeconds
return a TimeDuration representing this number of milliseconds
Same as milliseconds, for compatibility
usage example(s):
     1000 milliSeconds

o  milliseconds
return a TimeDuration representing this number of milliseconds.
Same as milliSeconds, for compatibility
usage example(s):
     1000 milliseconds

o  minutes
return a TimeDuration representing this number of minutes
usage example(s):
     1000 milliseconds
     10 seconds
     10 minutes

o  nanoseconds
return a TimeDuration representing this number of nanoseconds.
usage example(s):
     40.5 nanoseconds asPicoseconds
     (40.5 nanoseconds / 2) asPicoseconds

     40 nanoseconds
     40 nanoseconds asPicoseconds
     44 milliseconds asMicroseconds
     44 milliseconds 

o  picoseconds
return a TimeDuration representing this number of picoseconds.
usage example(s):
     40 picoseconds

o  seconds
return a TimeDuration representing this number of seconds
usage example(s):
     1000 milliseconds
     10 seconds
     10 minutes

o  weeks
return a TimeDuration representing this number of weeks
usage example(s):
     1000 milliseconds
     10 seconds
     10 minutes
     1 days
     1 weeks

double dispatching
o  differenceFromTimestamp: aTimestamp
I am to be interpreted as seconds, return the timestamp this number of seconds
before aTimestamp
usage example(s):
     100.0 differenceFromTimestamp:Timestamp now

     |t1 t2|
     t1 := Timestamp now.
     t2 := 1.5 differenceFromTimestamp:t1.
     t1 inspect. t2 inspect.

intervals
o  downTo: stop
return an interval from receiver down to the argument, incrementing by -1
usage example(s):
     (10 downTo:1) do:[:i | Transcript showCR:i].

o  downTo: stop by: step
return an interval from receiver down to the argument, decrementing by step
usage example(s):
     (10 downTo:1 by:0.5) do:[:i | Transcript showCR:i].

o  to: stop
return an interval from receiver up to the argument, incrementing by 1

o  to: stop by: step
return an interval from receiver up to the argument, incrementing by step

o  to: stop byFactor: factor
return a geometric series from receiver up to the argument;
elements have a constant factor in between
usage example(s):
     (1 to:256 byFactor:2)
     (256 to:1 byFactor:1/2)

iteration
o  timesRepeat: aBlock
evaluate the argument, aBlock self times

mathematical functions
o  agm: y
return the arithmetic-geometric mean agm(x, y) of the receiver (x) and the argument, y.
See https://en.wikipedia.org/wiki/Arithmetic-geometric_mean
and http://www.wolframalpha.com/input/?i=agm(24,+6)
usage example(s):
     24 agm:6

o  cbrt
return the cubic root of the receiver

o  conjugated
Return the complex conjugate of this Number.

o  exp
compute e**x of the receiver

o  floorLog: radix
return the logarithm truncated as an integer

o  imaginary
Return the imaginary part of this Number.

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

o  ln
return the natural logarithm of myself.
Raises an exception, if the receiver is less or equal to zero.
usage example(s):
     (10 raisedTo:1000) ln

o  log
return log base 10 of the receiver.
Alias for log:10.

o  log10
return log base-10 of the receiver.
Raises an exception, if the receiver is less or equal to zero.
Here, fallback to the general logarithm code.
usage example(s):
     (10 raisedTo:1000) log10
     (10 raisedTo:2000) log10
     (10 raisedTo:4000) log10
     (10 raisedTo:8000) log10

o  log: aNumber
return log base aNumber of the receiver.
This will usually return a float value
usage example(s):
      1000 log:10
      9 log:3
      (1000 log:10) floor
      (10 raisedTo:1000) log:10

o  nthRoot: n
return the nth root of the receiver
usage example(s):
     10 nthRoot:2 -> 3.16227766016838
     10 nthRoot:3 -> 2.154434690031883722

     100.0 nthRoot:4 
     100.0 nthRoot:5
     (100.0 nthRoot:6) raisedTo:6

     16.0 nthRoot:2
     -16.0 nthRoot:3
     -16.0 nthRoot:5
     
     -16.0 nthRoot:4

o  raisedTo: aNumber
return the receiver raised to aNumber
usage example(s):
     2 raisedTo: 4
     -2 raisedTo: 4
     4 raisedTo: 1/2
     -4 raisedTo: 1/2
     8 raisedTo: 1/3
     -8 raisedTo: 1/3
     10 raisedTo: 4
     10 raisedTo: -4

o  real
Return the real part of this Number.

o  sqrt
return the square root of the receiver

o  timesTwoPower: anInteger
Return the receiver multiplied by 2 raised to the power of the argument.
For protocol completeness wrt. Squeak and ST80.
usage example(s):
     123 timesTwoPower:0   -> 123
     123 timesTwoPower:1   -> 246
     123 timesTwoPower:2   -> 492
     123 timesTwoPower:3   -> 984

     (2 timesTwoPower: -150) timesTwoPower: 150  -> 2

measurement values
o  maxValue
the maximum possible value taking me as a measurement with possible error;
as I am exact, that's myself

o  minValue
the minimum possible value taking me as a measurement with possible error;
as I am exact, that's myself

printing & storing
o  displayOn: aGCOrStream
return a string to display the receiver.
The output radix is usually 10, but can be changed by setting
DefaultDisplayRadix (see Integer>>displayRadix:)

o  printOn: aStream
append a printed description of the receiver to aStream

o  printOn: aStream base: b
return a string representation of the receiver in the specified
radix (without the initial XXr)
usage example(s):
     10 printOn:Transcript base:3
     31 printOn:Transcript base:3
     -20 printOn:Transcript base:16
     -20 printOn:Transcript base:10
     3000 factorial printOn:Transcript base:10

o  printOn: aStream base: b showRadix: showRadix
the central print method for integer.
Must be defined in concrete classes

** This method raises an error - it must be redefined in concrete classes **

o  printOn: aStream paddedWith: padCharacter to: size base: radix
100 printOn:Transcript paddedWith:$0 to:10 base:10. Transcript cr.
100 printOn:Transcript paddedWith:$0 to:10 base:16. Transcript cr.
100 printOn:Transcript paddedWith:(Character space) to:10 base:16. Transcript cr.
100 printOn:Transcript paddedWith:(Character space) to:10 base:2. Transcript cr.

o  printOn: aStream thousandsSeparator: thousandsSeparator
print the receiver as business number with thousands separator to aStream.
thousandsSeparator is locale specific and is usualy a single quote ('), a comma or period.
usage example(s):
     swiss style:
     1000000 printOn:Transcript thousandsSeparator:$'.     Transcript cr.
     12345678 printOn:Transcript thousandsSeparator:$'.     Transcript cr.
     1234567 printOn:Transcript thousandsSeparator:$'.     Transcript cr.
     123456 printOn:Transcript thousandsSeparator:$'.     Transcript cr.
     123056 printOn:Transcript thousandsSeparator:$'.     Transcript cr.
     12345 printOn:Transcript thousandsSeparator:$'.     Transcript cr.
     1234 printOn:Transcript thousandsSeparator:$'.     Transcript cr.
     123 printOn:Transcript thousandsSeparator:$'.     Transcript cr.

     (12345678.12 asFixedPoint:2) printOn:Transcript thousandsSeparator:$'.     Transcript cr.
     1234567.12 printOn:Transcript thousandsSeparator:$'.     Transcript cr.
     123456.12 printOn:Transcript thousandsSeparator:$'.     Transcript cr.
     123056.12 printOn:Transcript thousandsSeparator:$'.     Transcript cr.
     12345.12 printOn:Transcript thousandsSeparator:$'.     Transcript cr.
     1234.12 printOn:Transcript thousandsSeparator:$'.     Transcript cr.
     123.12 printOn:Transcript thousandsSeparator:$'.     Transcript cr.

     us style:
     1000000 printOn:Transcript thousandsSeparator:$,.     Transcript cr.
     12345678 printOn:Transcript thousandsSeparator:$,.     Transcript cr.
     1234567 printOn:Transcript thousandsSeparator:$,.     Transcript cr.
     123456 printOn:Transcript thousandsSeparator:$,.     Transcript cr.
     12345 printOn:Transcript thousandsSeparator:$,.     Transcript cr.
     1234 printOn:Transcript thousandsSeparator:$,.     Transcript cr.
     123 printOn:Transcript thousandsSeparator:$,.     Transcript cr.

     german (european ?) style
     1000000 printOn:Transcript thousandsSeparator:$..     Transcript cr.
     12345678 printOn:Transcript thousandsSeparator:$..     Transcript cr.
     1234567 printOn:Transcript thousandsSeparator:$..     Transcript cr.
     123456 printOn:Transcript thousandsSeparator:$..     Transcript cr.
     12345 printOn:Transcript thousandsSeparator:$..     Transcript cr.
     1234 printOn:Transcript thousandsSeparator:$..     Transcript cr.
     123 printOn:Transcript thousandsSeparator:$..     Transcript cr.

o  printStringFormat: formatString

o  printStringRadix: base
return a string representation of the receiver in the specified
base; does NOT prepend XXr to the string.
See also: radixPrintStringRadix:
printOn:base:showRadix:
usage example(s):
     10000000000000000000000000000000000000000000 printStringRadix:16    
     -10000000000000000000000000000000000000000000 printStringRadix:16   

o  printStringRadix: base showRadix: showRadixBoolean
return a string representation of the receiver in the specified
base; does NOT prepend XXr to the string.
See also: radixPrintStringRadix:
printOn:base:showRadix:
usage example(s):
     10000000000000000000000000000000000000000000 printStringRadix:16 showRadix:false
     10000000000000000000000000000000000000000000 printStringRadix:16 showRadix:true

o  printStringWithThousandsSeparator
print the receiver as swiss business number with thousands separator to aStream.
Caveat: Should use the separator from the locale here
usage example(s):
     1000000 printStringWithThousandsSeparator
     12345678 printStringWithThousandsSeparator
     1234567 printStringWithThousandsSeparator
     123456 printStringWithThousandsSeparator
     12345 printStringWithThousandsSeparator
     1234 printStringWithThousandsSeparator
     123 printStringWithThousandsSeparator

     1000000 asFixedPoint printStringWithThousandsSeparator
     12345678 asFixedPoint printStringWithThousandsSeparator
     1234567 asFixedPoint printStringWithThousandsSeparator
     123456 asFixedPoint printStringWithThousandsSeparator
     12345 asFixedPoint printStringWithThousandsSeparator
     1234 asFixedPoint printStringWithThousandsSeparator
     123 asFixedPoint printStringWithThousandsSeparator
     ((9999999//10000) asFixedPoint:9) printStringWithThousandsSeparator
     ((99999999//10000) asFixedPoint:9) printStringWithThousandsSeparator

o  printStringWithThousandsSeparator: thousandsSeparator
print the receiver as business number with a thousands separator to aStream.
Notice:
americans use comma
germans (europeans ?) use a dot
swiss people (business people ?) use a single quote

Caveat: Should use the separator from the locale here
usage example(s):
     Transcript showCR:(1000000 printStringWithThousandsSeparator:$').
     Transcript showCR:(12345678 printStringWithThousandsSeparator:$').
     Transcript showCR:(1234567 printStringWithThousandsSeparator:$').
     Transcript showCR:(123456 printStringWithThousandsSeparator:$').
     Transcript showCR:(12345 printStringWithThousandsSeparator:$').
     Transcript showCR:(1234 printStringWithThousandsSeparator:$').
     Transcript showCR:(123 printStringWithThousandsSeparator:$').

     Transcript showCR:(1000000 printStringWithThousandsSeparator:$,).
     Transcript showCR:(12345678 printStringWithThousandsSeparator:$,).
     Transcript showCR:(1234567 printStringWithThousandsSeparator:$,).
     Transcript showCR:(123456 printStringWithThousandsSeparator:$,).
     Transcript showCR:(12345 printStringWithThousandsSeparator:$,).
     Transcript showCR:(1234 printStringWithThousandsSeparator:$,).
     Transcript showCR:(123 printStringWithThousandsSeparator:$,).

     Transcript showCR:((1000000 asFixedPoint:2) printStringWithThousandsSeparator:$,).
     Transcript showCR:((12345678 asFixedPoint:2) printStringWithThousandsSeparator:$,).
     Transcript showCR:((1234567 asFixedPoint:2) printStringWithThousandsSeparator:$,).
     Transcript showCR:((123456 asFixedPoint:2) printStringWithThousandsSeparator:$,).
     Transcript showCR:((12345 asFixedPoint:2) printStringWithThousandsSeparator:$,).
     Transcript showCR:((1234 asFixedPoint:2) printStringWithThousandsSeparator:$,).
     Transcript showCR:((123 asFixedPoint:2) printStringWithThousandsSeparator:$,).

o  printfPrintString: formatString
Return a printed representation of the receiver as specified by formatString,
which is defined by printf.
usage example(s):
     2.0 asQDouble printfPrintString:'%10f'
     2.0 asQDouble printfPrintString:'%10.8f'
     2.0 printfPrintString:'%10.8f'

o  radixPrintStringRadix: radix
return a string representation of the receiver in the specified
base; prepend XXr to the string
usage example(s):
     31 radixPrintStringRadix:2
     31 radixPrintStringRadix:3
     31 radixPrintStringRadix:10
     31 radixPrintStringRadix:16
     31 radixPrintStringRadix:36

o  storeOn: aStream
append a string for storing the receiver onto the argument, aStream
- since numbers are literals,they store as they print.

o  storeString
return a string for storing
- since numbers are literals, they store as they print.

taylor series
o  arcSin_withAccuracy: epsilon
compute the arcSine of the receiver using a taylor series approx.
usage example(s):
     0.5 arcSin                                    0.523599
     0.5q arcSin                        0.523598776

     0.5q arcSin_withAccuracy:1         0.520833333
     0.5q arcSin_withAccuracy:0.1       0.520833333
     0.5q arcSin_withAccuracy:0.01      0.523177083
     0.5q arcSin_withAccuracy:0.001     0.523525856

     0.5q arcSin_withAccuracy:1e-20     0.523598776

     0.5 asLargeFloat arcSin_withAccuracy:1e-30    -- not yet


     0.1 arcSin                                    0.100167
     0.1q arcSin                        0.100167421

     0.1q arcSin_withAccuracy:1         0.100166667
     0.1q arcSin_withAccuracy:0.1       0.100166667
     0.1q arcSin_withAccuracy:0.01      0.100166667
     0.1q arcSin_withAccuracy:0.001     0.100166667

     0.1q arcSin_withAccuracy:1e-20     0.100167421

     0.1 asLargeFloat arcSin_withAccuracy:1e-30    -- not yet

o  arcTan_withAccuracy: epsilon
compute the arcTangent of the receiver using a taylor series approx.
usage example(s):
     1.0 arcTan                       0.785398
     1q arcTan                        0.785398163

     1q arcTan_withAccuracy:1         0.666666667
     1q arcTan_withAccuracy:0.1       0.744011544
     1q arcTan_withAccuracy:0.01      0.790299653
     1q arcTan_withAccuracy:0.001     0.785897165

     1q arcTan_withAccuracy:1e-8      0.785398168
     1q arcTan_withAccuracy:1e-20     -- not yet, converges very slow


     0.5 arcTan                         0.463648
     0.5q arcTan                        0.463647609

     0.5q arcTan_withAccuracy:1         0.458333333
     0.5q arcTan_withAccuracy:0.1       0.458333333
     0.5q arcTan_withAccuracy:0.01      0.464583333
     0.5q arcTan_withAccuracy:0.001     0.463684276

     0.5q arcTan_withAccuracy:1e-20     0.463647609
     0.5 asLargeFloat arcTan_withAccuracy:1e-30    -- not yet

o  cbrt_withAccuracy: epsilon
compute cubic root of the receiver using a newton approx.
usage example(s):
     8q cbrt                                         2.0
     8q cbrt_withAccuracy:0.01                       2.000004911675504018
     8q cbrt_withAccuracy:0.0001                     2.000000000012062239
     8q cbrt_withAccuracy:0.0000001                  2.0
     8q cbrt_withAccuracy:0.0000000001               2.0
     8q cbrt_withAccuracy:0.000000000001             2.0
     8q cbrt_withAccuracy:LongFloat epsilon          2.0
     8q asQDouble cbrt_withAccuracy:QDouble epsilon  2.0

     27q cbrt_withAccuracy:0.01                      3.000000541064176501
     27q cbrt_withAccuracy:LongFloat epsilon         3.0
     -27q cbrt_withAccuracy:LongFloat epsilon        -3.0

     MessageTally spyOn:[ |arg|
        arg := 2 asLongFloat.
        1000000 timesRepeat:[
             arg cbrt_withAccuracy:0.000000000001
        ]
     ]
     Time millisecondsToRun:[ |arg|
        arg := 2 asLongFloat.
        1000000 timesRepeat:[
             arg cbrt_withAccuracy:0.000000000001
        ]
     ]

o  cos_withAccuracy: epsilon
compute the cosine of the receiver using a taylor series approx.
usage example(s):
     1.0 cos                                    0.540302
     1.0 asLongFloat cos_withAccuracy:1         0.5
     1.0 asLongFloat cos_withAccuracy:0.1       0.541666667
     1.0 asLongFloat cos_withAccuracy:0.01      0.540277778
     1.0 asLongFloat cos_withAccuracy:0.001     0.540302579

     1.0 asLongFloat cos_withAccuracy:1e-40     0.540302306

o  cosh_withAccuracy: epsilon
compute the hyperbolic cosine of the receiver using a taylor series approx.
usage example(s):
     1.0 cosh                                    1.54308
     1.0q cosh_withAccuracy:1         1.5
     1.0q cosh_withAccuracy:0.1       1.54308
     1.0q cosh_withAccuracy:0.01      1.54308
     1.0q cosh_withAccuracy:0.001     1.54308

     1.0q cosh_withAccuracy:1e-40   -> 1.543080

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

o  exp_withAccuracy: epsilon
compute e^x of the receiver using a taylor series approximation.
This method is only invoked for limitedPrecisionReal classes, which do not compute
exp themself (i.e. QDouble)

o  ln_withAccuracy: epsilon
compute ln of the receiver using a taylor series approx.
usage example(s):
     2.0 ln                         0.693147180559945
     2.0q ln                        0.6931471805599453094

     2.0q ln_withAccuracy:1                  0.691358025
     2.0q ln_withAccuracy:0.1                0.691358025
     2.0q ln_withAccuracy:0.01               0.693004115
     2.0q ln_withAccuracy:0.0000001          0.69314718
     2.0q ln_withAccuracy:1e-10              0.6931471805589163927
     2.0q ln_withAccuracy:1e-20              0.6931471805599453094
     2.0q ln_withAccuracy:1e-40              0.6931471805599453094
     2.0q ln_withAccuracy:2.0q class epsilon 0.6931471805599453094

     (2 ln_withAccuracy:1e-40) -> a fraction        
     0 ln_withAccuracy:1e-40

     (2 ln_withAccuracy:1e-100) asFixedPoint:100
     (2 asFixedPoint:200) ln_withAccuracy:(1/(10 raisedTo:200))
        0.69314718055994530941723212145817656807550013436025525412068000949339362196969471560586332699641868754200148102057068573368552023575813055703267075163507596193072757082837143519030703862389167347112335

     (2 asFixedPoint:400) ln_withAccuracy:(1/(10 raisedTo:400))
        0.69314718055994530941723212145817656807550013436025525412068000949339362196969471560586332699641868754200148102057068573368552023575813055703267075163507596193072757082837143519030703862389167347112335 01153644979552391204751726815749320651555247341395258829504530070953263666426541042391578149520437404303855008019441706416715186447128399681717845469570262716310645461502572074024816377733896385506953

     (2.0 asQDouble ln_withAccuracy:QDouble epsilon) printfPrintString:'%60.58f'
        0.69314718055994 52709398341558750792990469129794959648865081'

     Wolfram says:
        0.69314718055994530941723212145817656807550013436025525412068000949339362196969471560586332699641868754200148102057068573368552023575813055703267075163507596193072757082837143519030703862389167347112335 01153644979552391204751726...

o  nthRoot: n withAccuracy: epsilon
compute nth root of the receiver using a newton approx.
usage example(s):
     8q nthRoot:3 withAccuracy:0.01               2.00000002488636242
     8q nthRoot:3 withAccuracy:0.0001             2.00000000000000031
     8q nthRoot:3 withAccuracy:0.0000001          2.00000000000000031
     8q nthRoot:3 withAccuracy:0.0000000001       2.0
     8q nthRoot:3 withAccuracy:0.000000000001     2.0
     8q nthRoot:3 withAccuracy:LongFloat epsilon  2.0

     27q nthRoot:3 withAccuracy:0.01                3.000000081210202031
     27q nthRoot:3 withAccuracy:LongFloat epsilon   3.0
     -27q nthRoot:3 withAccuracy:LongFloat epsilon  -3.0

     10000q nthRoot:5 withAccuracy:1e-18        -> 6.309573444801932495 

     (10000 asQDouble nthRoot:5) printfPrintString:'%70.68f'
               6.30957344480193249434360136622343864672945257188228724527729528834741'

     actual result (Mathematica):        
               6.309573444801932494343601366223438646729452571882287245277...

o  sin_withAccuracy: epsilon
compute the sine of the receiver using a taylor series approx.
usage example(s):
     1.0 sin                                    0.841471
     1.0q sin                        0.841470985

     1.0q sin_withAccuracy:1         0.833333333
     1.0q sin_withAccuracy:0.1       0.841666667
     1.0q sin_withAccuracy:0.01      0.841666667
     1.0q sin_withAccuracy:0.001     0.841468254

     1.0q sin_withAccuracy:1e-40     0.841470985

o  sinh_withAccuracy: epsilon
compute the hyperbolic sine of the receiver using a taylor series approx.
usage example(s):
     1.0 sinh                                    1.1752
     1q sinh                        1.17520119

     1q sinh_withAccuracy:1         1.16666667
     1q sinh_withAccuracy:0.1       1.175
     1q sinh_withAccuracy:0.01      1.175
     1q sinh_withAccuracy:0.001     1.17519841

     1q sinh_withAccuracy:1e-40     1.17520119

o  sqrt_withAccuracy: epsilon
compute square root of the receiver using newton-raphson/heron algorithm
usage example(s):
     2 sqrt                                  1.4142135623731      - computed by CPU/FPU
     200000000 sqrt                          
     
     2q sqrt                                 1.414213562373095049 - computed by CPU/FPU

     2q sqrt_withAccuracy:0.01               1.414215686274509804 - computed by Smalltalk
     2q sqrt_withAccuracy:0.0001             1.414213562374689911
     2q sqrt_withAccuracy:0.0000001          1.414213562373095049
     2q sqrt_withAccuracy:0.0000000001       1.414213562373095049
     2q sqrt_withAccuracy:0.000000000001     1.414213562373095049
     
     2q sqrt_withAccuracy:LongFloat epsilon  1.414213562373095049

     (4 sqrt_withAccuracy:Integer epsilon) asFloat

     MessageTally spyOn:[ |arg|
        arg := 2 asLongFloat.
        1000000 timesRepeat:[
             arg sqrt_withAccuracy:0.000000000001
        ]
     ]
     Time millisecondsToRun:[ |arg|
        arg := 2 asLongFloat.
        1000000 timesRepeat:[
             arg sqrt_withAccuracy:0.000000000001
        ]
     ]

o  sqrt_withAccuracy: epsilon fromInitialGuess: guess
compute square root of the receiver using newton-raphson/heron algorithm
usage example(s):
     2 sqrt                                  1.4142135623731
     2q sqrt                                 1.414213562373095049
     2q sqrt_withAccuracy:0.01               1.414215686274509804
     2q sqrt_withAccuracy:0.0001             1.414213562374689911
     2q sqrt_withAccuracy:0.0000001          1.414213562373095049
     2q sqrt_withAccuracy:0.0000000001       1.414213562373095049
     2q sqrt_withAccuracy:0.000000000001     1.414213562373095049
     2q sqrt_withAccuracy:LongFloat epsilon  1.414213562373095049

     (2 asQDouble sqrt_withAccuracy:LongFloat epsilon) printfPrintString:'%70.68f'
            1.41421356237309504880168872420969807856967187537723400156101313309966

     (4 sqrt_withAccuracy:Integer epsilon) asFloat

     MessageTally spyOn:[ |arg|
        arg := 2 asLongFloat.
        1000000 timesRepeat:[
             arg sqrt_withAccuracy:0.000000000001
        ]
     ]
     Time millisecondsToRun:[ |arg|
        arg := 2 asLongFloat.
        1000000 timesRepeat:[
             arg sqrt_withAccuracy:0.000000000001
        ]
     ]

o  tan_withAccuracy: epsilon
compute the tangens of the receiver using a taylor series approx.
usage example(s):
     0.5 tan                         0.546302
     0.5q tan                        0.54630249

     0.5q tan_withAccuracy:1         0.541666667
     0.5q tan_withAccuracy:0.1       0.541666667
     0.5q tan_withAccuracy:0.01      0.545833333
     0.5q tan_withAccuracy:0.001     0.54625496
     0.5q tan_withAccuracy:1e-15     0.54630249

     0.5q tan_withAccuracy:1e-40     -- too many iterations

testing
o  even
return true if the receiver is divisible by 2.
usage example(s):
     2 even
     2.0 even
     3.0 even
     2.4 even
     (5/3) even

     2 asFraction even
     (2 asFixedPoint:5) even
     2 asFloatE even
     2 asFloatD even
     2 asFloatQ even
     2 asFloatQD even

     (2.1 asFloatQD - (QDouble readFrom:'2.1')) fractionPart

o  isDivisibleBy: aNumber
return true, if the receiver can be divided by the argument, aNumber without a remainder.
Notice, that the result is only worth trusting, if the receiver is an integer.
usage example(s):
     3 isDivisibleBy:2
     4 isDivisibleBy:2
     4.0 isDivisibleBy:2
     4.5 isDivisibleBy:4.5
     4.5 isDivisibleBy:1.0

o  isNaN
return true, if the receiver is an invalid float (NaN - not a number).

o  isNumber
return true, if the receiver is a kind of number

o  isPerfectSquare
return true if I am a perfect square.
That is a number for which the square root is an integer.
usage example(s):
     0 isPerfectSquare
     0.0 isPerfectSquare
     3 isPerfectSquare
     3.0 isPerfectSquare
     4 isPerfectSquare
     4.0 isPerfectSquare
     9 isPerfectSquare
     9.0 isPerfectSquare

o  isReal
return true, if the receiver is some kind of real number (as opposed to a complex);
true is returned here - the method is redefined from Object.

o  isZero
return true, if the receiver is zero

tracing
o  traceInto: aRequestor level: level from: referrer
double dispatch into tracer, passing my type implicitely in the selector

trigonometric
o  arcCos
return the arccosine of the receiver (in radians)

o  arcCosech
return the inverse hyperbolic cosecant of the receiver.

o  arcCosh
return the inverse hyperbolic cosine of the receiver.

o  arcCoth
return the inverse hyperbolic cotangent of the receiver.

o  arcSech
return the inverse hyperbolic secant of the receiver.

o  arcSin
return the arcsine of the receiver (in radians)

o  arcSinh
return the inverse hyperbolic sine of the receiver.
usage example(s):
^ self arcSinh_withAccuracy:self epsilon

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

o  arcTan2: x
return atan2(self,x) (as radians)

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

o  arcTanh
return the inverse hyperbolic tangent of the receiver.

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

o  cosh
return the hyperbolic cosine of the receiver

o  cot
return the cotangent of the receiver

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

o  sinh
return the hyperbolic sine of the receiver
usage example(s):
        10 sinh                     -> 11013.23287470339338
        (10 exp - (-10 exp)) / 2    -> 11013.23287470339338

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

o  tanh
return the hyperbolic tangens of the receiver

truncation & rounding
o  detentBy: detent atMultiplesOf: grid snap: snap
Map all values that are within detent/2 of any multiple of grid
to that multiple.
Otherwise, if snap is true, return self, meaning that the values
in the dead zone will never be returned.
If snap is false, then expand the range between dead zones
so that it covers the range between multiples of the grid,
and scale the value by that factor.
usage example(s):
     (170 to: 190 by: 2) collect: [:a | a detentBy: 10 atMultiplesOf: 90 snap: true]
     (170 to: 190 by: 2) collect: [:a | a detentBy: 10 atMultiplesOf: 90 snap: false]
     (3.9 to: 4.1 by: 0.02) collect: [:a | a detentBy: 0.1 atMultiplesOf: 1.0 snap: true]
     (-3.9 to: -4.1 by: -0.02) collect: [:a | a detentBy: 0.1 atMultiplesOf: 1.0 snap: false]

o  fractionPart
return a float with value from digits after the decimal point.
i.e. the receiver minus its truncated value,
such that (self truncated + self fractionPart) = self
usage example(s):
     1234.56789 fractionPart
     1.2345e6 fractionPart

     1.6 asLongFloat fractionPart + 1.6 asLongFloat truncated
     -1.6 asLongFloat fractionPart + -1.6 asLongFloat truncated

o  integerPart
return a float with value from digits before the decimal point
(i.e. the truncated value)
usage example(s):
     1234.56789 integerPart
     1.2345e6 integerPart
     12.5 integerPart
     -12.5 integerPart
     (5/3) integerPart
     (-5/3) integerPart
     (5/3) truncated
     (-5/3) truncated



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Sat, 21 Jul 2018 19:34:51 GMT