eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'IEEEFloat':

Home

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

Class: IEEEFloat


Inheritance:

   Object
   |
   +--Magnitude
      |
      +--ArithmeticValue
         |
         +--Number
            |
            +--LimitedPrecisionReal
               |
               +--AbstractIEEEFloat
                  |
                  +--IEEEFloat

Package:
stx:libbasic2
Category:
Magnitude-Numbers
Version:
rev: 1.50 date: 2021/11/08 11:39:16
user: cg
file: IEEEFloat.st directory: libbasic2
module: stx stc-classLibrary: libbasic2

Description:


Unfinished, ongoing work

Soft float emulation for arbitrary IEEE binary float formats.
This is very very slow and should only be used when importing 
funny sized floating point numbers (such as float24 or float8) from
external sources, or to simulate computations on otherwise unsupported floating pnt numbers.

Create one by passing the overall number of bits and the number of exponent-bits:
    IEEEFloat size:64 exponentSize:(Float numBitsInExponent)
or:
    1.0 asIEEEFloat
will give you a (slow) variant of a regular float.

And:
    1.0 asIEEEFloat:128
will return a standard quadruple float,
And:
    IEEEFloat size:128 exponentSize:15
    IEEEFloat size:256 exponentSize:19
will give you a 128/256 bit ieee float resp..

copyright

COPYRIGHT (c) 2018 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:

coercing & converting
o  coerce: aNumber
convert the argument aNumber into an instance of the receiver (class) and return it.

instance creation
o  fromInteger: anInteger
convert to one of 64, 128 or 256 bit IEEEFloat,
depending on the number of bits required

Usage example(s):

     self fromInteger:1     
     self fromInteger:-1
     self fromInteger:2
     self fromInteger:1024 * 1024 * 1024 * 1024 * 1024 * 1024
     self fromInteger:1e20 asInteger
     self fromInteger:1e100 asInteger
     self fromInteger:2r1010101010101010101010101010101
     self fromInteger:2r1010101010101010101010101010101010101010101010101010101010101010
     self fromInteger:(2 raisedTo:10000)   
     1 asIEEEFloat


Instance protocol:

accessing
o  exponentSize

coercing & converting
o  asIEEEFloat

o  generality
depends on my precision:
return the generality of a corresponding builtin number type,
depending on my precision

Usage example(s):

     1 asShortFloat generality 70
     1 asFloat generality      80
     1 asLongFloat generality  90
     1 asQDouble generality    95
     1 asLargeFloat generality 100

     1 asIEEEFloat generality  97

     1 asQuadFloat generality
     1 asOctaFloat generality

private accessing
o  exponentSize: numBitsInExponent

queries
o  numBitsInExponent
1.0 numBitsInExponent 11
1.0 numBitsInMantissa 52
1.0 precision 53
1.0 decimalPrecision 16
1.0 eBias 1023
1.0 emin -1022
1.0 emax 1023
1.0 fmin 2.2250738585072E-308
1.0 fmax 1.79769313486232E+308



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sun, 22 Dec 2024 03:46:00 GMT