diff -r 96b983d12f98 -r 89005eece5f4 LimitedPrecisionReal.st --- a/LimitedPrecisionReal.st Mon Jun 12 21:04:32 2017 +0200 +++ b/LimitedPrecisionReal.st Mon Jun 12 21:05:04 2017 +0200 @@ -59,28 +59,34 @@ Format | Class | Array Class | Bits / Significant | Smallest Pos Number | Largest Pos Number | Significant Digits | | | (Binary) | | | (Decimal) -------+------------+-----------------+---------------------+---------------------+--------------------+-------------------- - half | -- | HalfFloatArray | 16 / 11 | 6.10... x 10−5 | 6.55... x 10+5 | 3.3 + half | -- | HalfFloatArray | 16 / 11 | 6.10.... x 10−5 | 6.55... x 10+5 | 3.3 -------+------------+-----------------+---------------------+---------------------+--------------------+-------------------- - single | ShortFloat | FloatArray | 32 / 24 | 1.175...x 10-38 | 3.402... 10+38 | 6-9 + single | ShortFloat | FloatArray | 32 / 24 | 1.175... x 10-38 | 3.402... x 10+38 | 6-9 -------+------------+-----------------+---------------------+---------------------+--------------------+-------------------- - double | Float | DoubleArray | 64 / 53 | 2.225...x 10-308 | 1.797... 10+308 | 15-17 + double | Float | DoubleArray | 64 / 53 | 2.225... x 10-308 | 1.797... x 10+308 | 15-17 -------+------------+-----------------+---------------------+---------------------+--------------------+-------------------- - double | LongFloat | -- | 128 / 113 | 3.362...x 10-4932 | 1.189... 10+4932 | 33-36 + double | LongFloat | -- | 128 / 113 | 3.362... x 10-4932 | 1.189... x 10+4932 | 33-36 ext | | | | | | (SPARC)| | | | | | -------+ | |---------------------+---------------------+--------------------+-------------------- - double | | | 96 / 64 | 3.362...x 10-4932 | 1.189... 10+4932 | 18-21 + double | | | 96 / 64 | 3.362... x 10-4932 | 1.189... x 10+4932 | 18-21 ext | | | | | | (x86) | | | | | | -------+------------+-----------------+---------------------+---------------------+--------------------+-------------------- + -- | QDouble | -- | 256 / 212 | 2.225... x 10-308 | 1.797... x 10+308 | >=60 + -------+------------+-----------------+---------------------+---------------------+--------------------+-------------------- -- | LargeFloat | -- | arbitrary | arbitrarily small | arbitrarily large | arbitrary -------+------------+-----------------+---------------------+---------------------+--------------------+-------------------- - HalfFloats are only supported in fixed array containers. This was added for OpenGL and other graphic libraries which allow - for texture, and vertex data to be passed quickly in that format (see http://www.opengl.org/wiki/Small_Float_Formats). + HalfFloats are only supported in fixed array containers. + This was added for OpenGL and other graphic libraries which allow for texture, + and vertex data to be passed quickly in that format (see http://www.opengl.org/wiki/Small_Float_Formats). + Long- and LargeFloat are not supported as array containers. These formats are seldom used for bulk data. + QDoubles are special soft floats; slower in performance, but providing 4 times the prevision of regular doubles. + Bulk Containers: ================ If you have a vector or matrix (and especially: large ones) of floating point numbers, the well known @@ -415,7 +421,8 @@ ! epsilon - "return the maximum relative spacing" + "return the maximum relative spacing of instances of mySelf + (i.e. the value-delta of the least significant bit)" ^ self radix asFloat raisedToInteger:(1 - self precision) @@ -424,6 +431,8 @@ Float epsilon LongFloat epsilon " + + "Modified (comment): / 12-06-2017 / 18:52:31 / cg" ! fmax @@ -584,6 +593,16 @@ "return the number of valid mantissa bits" ^ self numBitsInMantissa + 1 - self numBitsInIntegerPart + + " + HalfFloat precision + ShortFloat precision + Float precision + LongFloat precision + QDouble precision + " + + "Modified (comment): / 12-06-2017 / 18:47:54 / cg" ! radix @@ -905,7 +924,11 @@ ! asLargeFloat + "return a large float with (approximately) my value" + ^ LargeFloat fromLimitedPrecisionReal:self + + "Modified (comment): / 12-06-2017 / 20:57:05 / cg" ! asLimitedPrecisionReal