eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'MetaNumber':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: MetaNumber


Inheritance:

   Object
   |
   +--Magnitude
      |
      +--ArithmeticValue
         |
         +--Number
            |
            +--MetaNumber
               |
               +--Infinity
               |
               +--NotANumber
               |
               +--SomeNumber

Package:
stx:libbasic
Category:
Magnitude-Numbers
Version:
rev: 1.16 date: 2021/12/15 00:00:23
user: cg
file: MetaNumber.st directory: libbasic
module: stx stc-classLibrary: libbasic

Description:


Common behavior for metaNumbers (INF, NaN).

copyright

COPYRIGHT (c) 2003 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

queries
o  isAbstract
Return if this class is an abstract class.
True is returned here for myself only; false for subclasses.
Abstract subclasses must redefine this again.


Instance protocol:

coercing & converting
o  asFloat
return a Float (i.e. an IEEE double) with same value as the receiver.
For anything but NaN, +Inf or -Inf, an error is raised here.

Usage example(s):

     MetaNumber infinity asFloat
     MetaNumber negativeInfinity asFloat 
     MetaNumber NaN asFloat 

o  asFraction
consistency with other converters

o  asInstanceOf: aFloatClass fromSelector: selector
common code for asShortFloat, asFloat, ...
Return an instance of aFloatClass with same value as the receiver.
For anything but NaN, +Inf or -Inf, an error is raised here.

o  asInteger
(comment from inherited method)
return an integer with same value - might truncate

o  asIntegerChecked
Infinity positive asInteger
Infinity positive asIntegerChecked
Infinity negative asInteger
Infinity negative asIntegerChecked

o  asLargeFloat
( an extension from the stx:libbasic2 package )
return a LongFloat with same value as the receiver.
For anything but NaN, +Inf or -Inf, an error is raised here.

Usage example(s):

     MetaNumber infinity asLargeFloat
     MetaNumber negativeInfinity asLargeFloat 
     MetaNumber NaN asLargeFloat 

o  asLongFloat
return a LongFloat with same value as the receiver.
For anything but NaN, +Inf or -Inf, an error is raised here.

Usage example(s):

     MetaNumber infinity asLongFloat
     MetaNumber negativeInfinity asLongFloat 
     MetaNumber NaN asLongFloat 

o  asOctaFloat
( an extension from the stx:libbasic2 package )
return an OctaFloat with same value as the receiver.
For anything but NaN, +Inf or -Inf, an error is raised here.

Usage example(s):

     Infinity NaN asFloat
     Infinity NaN asOctaFloat
     
     Infinity positive asFloat
     Infinity positive asOctaFloat

     Infinity negative asFloat
     Infinity negative asOctaFloat

o  asQDouble
( an extension from the stx:libbasic2 package )
return a QDouble with same value as the receiver.
For anything but NaN, +Inf or -Inf, an error is raised here.

Usage example(s):

     Infinity NaN asFloat
     Infinity NaN asQDouble
     
     Infinity positive asFloat
     Infinity positive asQDouble

     Infinity negative asFloat
     Infinity negative asQDouble

o  asQuadFloat
( an extension from the stx:libbasic2 package )
return a QuadFloat with same value as the receiver.
For anything but NaN, +Inf or -Inf, an error is raised here.

Usage example(s):

     Infinity NaN asFloat
     Infinity NaN asQuadFloat
     
     Infinity positive asFloat
     Infinity positive asQuadFloat

     Infinity negative asFloat
     Infinity negative asQuadFloat

o  asShortFloat
return a Float with same value as the receiver.
For anything but NaN, +Inf or -Inf, an error is raised here.

o  asTrueFraction
return a Fraction with same value as the receiver.
For anything but NaN, +Inf or -Inf, an error is raised here.

o  coerce: aNumber
convert the argument aNumber into an instance of the receiver's class and return it.

o  generality
NaN, INF etc. are more general than scalars, but not more general than
vectors (e.g. Points)



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 14 Dec 2024 18:40:56 GMT