Back: RunArray-testing Up: Base classes Forward: ScaledDecimal class-instance creation   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.140 ScaledDecimal

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

1.140.1 ScaledDecimal class: instance creation  (class)
1.140.2 ScaledDecimal: arithmetic  (instance)
1.140.3 ScaledDecimal: coercion  (instance)
1.140.4 ScaledDecimal: comparing  (instance)
1.140.5 ScaledDecimal: constants  (instance)
1.140.6 ScaledDecimal: printing  (instance)
1.140.7 ScaledDecimal: storing  (instance)


1.140.1 ScaledDecimal class: instance creation

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.


1.140.2 ScaledDecimal: arithmetic

* 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.


1.140.3 ScaledDecimal: coercion

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.


1.140.4 ScaledDecimal: comparing

< 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.


1.140.5 ScaledDecimal: constants

one
Answer the receiver's representation of one.

zero
Answer the receiver's representation of zero.


1.140.6 ScaledDecimal: printing

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.


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



Back: ScaledDecimal-printing Up: ScaledDecimal Forward: SecurityPolicy   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