Back: FileStream-testing Up: Base classes Forward: Float class-byte-order dependancies   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.75 Float

Defined in namespace Smalltalk
Superclass: Number
Category: Language-Data types
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.

1.75.1 Float class: byte-order dependancies  (class)
1.75.2 Float class: characterization  (class)
1.75.3 Float: arithmetic  (instance)
1.75.4 Float: basic  (instance)
1.75.5 Float: built ins  (instance)
1.75.6 Float: coercing  (instance)
1.75.7 Float: coercion  (instance)
1.75.8 Float: comparing  (instance)
1.75.9 Float: printing  (instance)
1.75.10 Float: storing  (instance)
1.75.11 Float: testing  (instance)
1.75.12 Float: testing functionality  (instance)
1.75.13 Float: transcendental operations  (instance)


1.75.1 Float class: byte-order dependancies

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


1.75.2 Float class: characterization

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.


1.75.3 Float: arithmetic

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


1.75.4 Float: basic

hash
Answer an hash value for the receiver


1.75.5 Float: built ins

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


1.75.6 Float: coercing

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.


1.75.7 Float: coercion

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


1.75.8 Float: comparing

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.


1.75.9 Float: printing

printOn: aStream
Print a representation of the receiver on aStream


1.75.10 Float: storing

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


1.75.11 Float: testing

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


1.75.12 Float: testing functionality

isFloat
Answer `true'.


1.75.13 Float: transcendental operations

asFloat
Just defined for completeness. Return the receiver.

ceilingLog: radix
Answer (self log: radix) ceiling.

estimatedLog
Answer an estimate of (self abs floorLog: 10)

floorLog: radix
Answer (self log: radix) floor.

log
Answer log base 10 of the receiver.



Back: Float-testing functionality Up: Float Forward: FloatD   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on May, 22 2008 using texi2html