#FEATURE by exept
authorClaus Gittinger <cg@exept.de>
Sun, 01 Dec 2019 16:11:02 +0100
changeset 5335 82756240a52d
parent 5334 fcba54f692d0
child 5336 24b6605706cb
#FEATURE by exept class: HalfFloat class added: #numBitsInMantissa #radix
HalfFloat.st
--- a/HalfFloat.st	Sun Dec 01 16:09:44 2019 +0100
+++ b/HalfFloat.st	Sun Dec 01 16:11:02 2019 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "{ Package: 'stx:libbasic2' }"
 
 "{ NameSpace: Smalltalk }"
@@ -61,6 +63,22 @@
     "
 
     ^ 4
+!
+
+numBitsInMantissa
+    "answer the number of bits in the mantissa (the significant).
+     This is an IEEE binary16, where 11 bits are available (the hidden bit is not counted here):
+        seeeemmm mmmmmmmm
+    "
+
+    ^ 11
+!
+
+radix
+    "answer the radix of a Float's exponent
+     This is an IEEE float, which is represented as binary"
+
+    ^ 2 
 ! !
 
 !HalfFloat class methodsFor:'documentation'!