Category: Language-Data types
Superclass: Number
My instances represent floating point numbers that have arbitrary precision. Besides the standard numerical operations, they provide transcendental operations too. They implement IEEE-754 correctly if the hardware supports it.

Method category index

byte-order dependancies (class)
characterization (class)
arithmetic (instance)
basic (instance)
built ins (instance)
coercing (instance)
coercion (instance)
comparing (instance)
compiler (instance)
converting (instance)
floating point (instance)
misc math (instance)
printing (instance)
storing (instance)
testing (instance)
testing functionality (instance)
transcendental operations (instance)
truncation and round off (instance)

byte-order dependancies (class)

signByte
Answer the byte of the receiver that contains the sign bit

top


characterization (class)

denormalized
Answer whether instances of the receiver can be in denormalized form.

e

Returns the value of e. Hope is that it is precise enough

epsilon

Return the smallest Float x for which is 1 + x ~= 1

fmin

Return the smallest Float that is > 0.

fminDenormalized

Return the smallest Float that is > 0 if denormalized values are supported, else return 0.

ln10

Returns the value of ln 10. Hope is that it is precise enough

log10Base2

Returns the value of log2 10. Hope is that it is precise enough

pi

Returns the value of pi. Hope is that it is precise enough

radix

Answer the base in which computations between instances of the receiver are made. This should be 2 on about every known computer, so GNU Smalltalk always answers 2.

top


arithmetic (instance)

integerPart
Return the receiver's integer part

negated

Return the negation of the receiver. Unlike 0-self, this converts correctly signed zeros.

raisedToInteger: anInteger

Return self raised to the anInteger-th power

top


basic (instance)

hash
Answer an hash value for the receiver. Not-a-number values do not have a hash code and cannot be put in a hashed collection.

top


built ins (instance)

arcCos
Answer the arc-cosine of the receiver

arcSin

Answer the arc-sine of the receiver

arcTan

Answer the arc-tangent of the receiver

ceiling

Answer the integer part of the receiver, truncated towards +infinity

cos

Answer the cosine of the receiver

exp

Answer 'e' (2.718281828459...) raised to the receiver

floor

Answer the integer part of the receiver, truncated towards -infinity

ln

Answer the logarithm of the receiver in base 'e' (2.718281828459...)

primHash

Private - Answer an hash value for the receiver

raisedTo: aNumber

Answer the receiver raised to its aNumber power

sin

Answer the sine of the receiver

sqrt

Answer the square root of the receiver

tan

Answer the tangent of the receiver

top


coercing (instance)

asExactFraction
Convert the receiver into a fraction with optimal approximation, but with usually huge terms.

asFraction

Convert the receiver into a fraction with a good (but undefined) approximation

truncated

Convert the receiver to an Integer. Only used for LargeIntegers, there are primitives for the other cases.

top


coercion (instance)

asCNumber
Convert the receiver to a kind of number that is understood by the C call-out mechanism.

top


comparing (instance)

max: aNumber
Answer the maximum between the receiver and aNumber. Redefine in subclasses if necessary to ensure that if either self or aNumber is a NaN, it is always answered.

min: aNumber

Answer the minimum between the receiver and aNumber. Redefine in subclasses if necessary to ensure that if either self or aNumber is a NaN, it is always answered.

withSignOf: aNumber

Answer the receiver, with its sign possibly changed to match that of aNumber.

top


compiler (instance)

literalEquals: anObject
Not commented.

literalHash

Not commented.

top


converting (instance)

half
Answer 0.5 in the representation of the receiver

top


floating point (instance)

predecessor
Not commented.

successor

Not commented.

top


misc math (instance)

log: aNumber
Answer log base aNumber of the receiver

top


printing (instance)

printOn: aStream
Print a representation of the receiver on aStream

top


storing (instance)

isLiteralObject
Answer whether the receiver is expressible as a Smalltalk literal.

storeLiteralOn: aStream

Store on aStream some Smalltalk code which compiles to the receiver

storeOn: aStream

Print a representation of the receiver on aStream

top


testing (instance)

isExact
Answer whether the receiver performs exact arithmetic. Floats do not.

isFinite

Answer whether the receiver does not represent infinity, nor a NaN

isInfinite

Answer whether the receiver represents positive or negative infinity

isNaN

Answer whether the receiver represents a NaN

negative

Answer whether the receiver is negative

positive

Answer whether the receiver is positive. Negative zero is not positive, so the definition is not simply >= 0.

sign

Answer 1 if the receiver is greater than 0, -1 if less than 0, else 0. Negative zero is the same as positive zero.

strictlyPositive

Answer whether the receiver is > 0

top


testing functionality (instance)

isFloat
Answer `true'.

top


transcendental operations (instance)

asFloat
Just defined for completeness. Return the receiver.

ceilingLog: radix

Answer (self log: radix) ceiling. Use exact arithmetic if radix is not a floating point value.

estimatedLog

Answer an estimate of (self abs floorLog: 10)

floorLog: radix

Answer (self log: radix) floor. Use exact arithmetic if radix is not a floating point value.

log

Answer log base 10 of the receiver.

top


truncation and round off (instance)

rounded
Answer the receiver, rounded to the nearest integer

top