Category: Language-Data types
Superclass: Number
ScaledDecimal provides a numeric representation of fixed point decimal numbers able to accurately represent decimal fractions. It supports unbounded precision, with no limit to the number of digits before and after the decimal point.

Method category index

instance creation (class)
arithmetic (instance)
coercion (instance)
comparing (instance)
constants (instance)
printing (instance)
storing (instance)

instance creation (class)

newFromNumber: aNumber scale: scale
Answer a new instance of ScaledDecimal, representing a decimal fraction with a decimal representation considered valid up to the scale-th digit.

top


arithmetic (instance)

* aNumber
Multiply two numbers and answer the result.

+ aNumber

Sum two numbers and answer the result.

- aNumber

Subtract aNumber from the receiver and answer the result.

/ aNumber

Divide two numbers and answer the result.

// aNumber

Answer the integer quotient after dividing the receiver by aNumber with truncation towards negative infinity.

\\ aNumber

Answer the remainder after integer division the receiver by aNumber with truncation towards negative infinity.

top


coercion (instance)

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

asFloatD

Answer the receiver, converted to a FloatD

asFloatE

Answer the receiver, converted to a FloatE

asFloatQ

Answer the receiver, converted to a FloatQ

asFraction

Answer the receiver, converted to a Fraction

ceiling

Answer the receiver, converted to an Integer and truncated towards +infinity.

coerce: aNumber

Answer aNumber, converted to a ScaledDecimal with the same scale as the receiver.

fractionPart

Answer the fractional part of the receiver.

generality

Return the receiver's generality

integerPart

Answer the fractional part of the receiver.

truncated

Answer the receiver, converted to an Integer and truncated towards -infinity.

top


comparing (instance)

< aNumber
Answer whether the receiver is less than arg.

<= aNumber

Answer whether the receiver is less than or equal to arg.

= arg

Answer whether the receiver is equal to arg.

> aNumber

Answer whether the receiver is greater than arg.

>= aNumber

Answer whether the receiver is greater than or equal to arg.

hash

Answer an hash value for the receiver.

~= arg

Answer whether the receiver is not equal arg.

top


constants (instance)

one
Answer the receiver's representation of one.

zero

Answer the receiver's representation of zero.

top


printing (instance)

displayOn: aStream
Print a representation of the receiver on aStream, intended to be directed to a user. In this particular case, the `scale' part of the #printString is not emitted.

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 Smalltalk code that compiles to the receiver on aStream.

top