Next: , Previous: , Up: Number   [Index]


1.122.6 Number: converting

asExactFraction

Return the receiver, converted to a Fraction retaining the exact value of the receiver.

asFloat

Convert the receiver to an arbitrary subclass of Float

asFloatD

This method’s functionality should be implemented by subclasses of Number

asFloatE

This method’s functionality should be implemented by subclasses of Number

asFloatQ

This method’s functionality should be implemented by subclasses of Number

asFraction

This method’s functionality should be implemented by subclasses of Number

asNumber

Answer the receiver, since it is already a number

asRectangle

Answer an empty rectangle whose origin is (self asPoint)

asScaledDecimal: n

Answer the receiver, converted to a ScaledDecimal object.

asScaledDecimal: denDigits radix: base scale: n

Answer the receiver, divided by base^denDigits and converted to a ScaledDecimal object.

asString

Answer the receiver’s #displayString, which should be a good enough conversion to String for a number.

coerce: aNumber

Answer aNumber, converted to an integer or floating-point number.

degreesToRadians

Convert the receiver to radians

generality

Answer the receiver’s generality

radiansToDegrees

Convert the receiver from radians to degrees

unity

Coerce 1 to the receiver’s class. The default implementation works, but is inefficient

zero

Coerce 0 to the receiver’s class. The default implementation works, but is inefficient