#DOCUMENTATION by exept
class: Float
class definition
comment/format in: #mantissa
class: Float class
added: #defaultPrintPrecision
comment/format in:
#defaultPrintFormat:
#defaultPrintfFormat:
#numBitsInMantissa
--- a/Float.st Sun Dec 01 16:10:29 2019 +0100
+++ b/Float.st Sun Dec 01 16:10:54 2019 +0100
@@ -17,9 +17,9 @@
LimitedPrecisionReal variableByteSubclass:#Float
instanceVariableNames:''
- classVariableNames:'DefaultPrintFormat DefaultPrintfFormat E Epsilon Halfpi
- HalfpiNegative Ln10 Ln2 MaxSmallInteger NaN NegativeInfinity Pi
- PositiveInfinity RadiansPerDegree Sqrt2 Twopi'
+ classVariableNames:'DefaultPrintFormat DefaultPrintfFormat DefaultPrintPrecision E
+ Epsilon Halfpi HalfpiNegative Ln10 Ln2 MaxSmallInteger NaN
+ NegativeInfinity Pi PositiveInfinity RadiansPerDegree Sqrt2 Twopi'
poolDictionaries:''
category:'Magnitude-Numbers'
!
@@ -526,16 +526,20 @@
^ DefaultPrintFormat
!
-defaultPrintFormat:something
- DefaultPrintFormat := something.
+defaultPrintFormat:aFormatString
+ DefaultPrintFormat := aFormatString.
+!
+
+defaultPrintPrecision
+ ^ DefaultPrintPrecision ? 6
!
defaultPrintfFormat
^ DefaultPrintfFormat
!
-defaultPrintfFormat:something
- DefaultPrintfFormat := something.
+defaultPrintfFormat:aFormatString
+ DefaultPrintfFormat := aFormatString.
! !
!Float class methodsFor:'binary storage'!
@@ -1032,8 +1036,8 @@
!
numBitsInMantissa
- "answer the number of bits in the mantissa.
- This is an IEEE double, where 52 bits (the hidden one is not counted here) are available:
+ "answer the number of bits in the mantissa (the significant).
+ This is an IEEE double (binary64), where 52 bits are available (the hidden bit is not counted here):
seeeeeee eeeemmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm mmmmmmmm
"
@@ -1050,7 +1054,6 @@
1.0 fmin 2.2250738585072E-308
1.0 fmax 1.79769313486232E+308
"
-
!
precision
@@ -2779,6 +2782,8 @@
"
1.0 exponent
1.0 mantissa
+ -1.0 exponent
+ -1.0 mantissa
0.25 exponent
0.25 mantissa