Number.st
changeset 3900 c3bc76767cfc
parent 3770 6db2b6d5d17d
child 3995 777470826394
--- a/Number.st	Wed Oct 28 17:18:45 1998 +0100
+++ b/Number.st	Wed Oct 28 17:19:13 1998 +0100
@@ -11,10 +11,10 @@
 "
 
 ArithmeticValue subclass:#Number
-        instanceVariableNames:''
-        classVariableNames:''
-        poolDictionaries:''
-        category:'Magnitude-Numbers'
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Magnitude-Numbers'
 !
 
 !Number class methodsFor:'documentation'!
@@ -583,8 +583,40 @@
     "Modified: 18.7.1996 / 12:40:49 / cg"
 ! !
 
+!Number methodsFor:'truncation and rounding'!
+
+fractionPart
+    "return a float with value from digits after the decimal point.
+     (i.e. the receiver minus its truncated value)"
+
+    ^ self - self truncated asFloat
+
+    "
+     1234.56789 fractionPart
+     1.2345e6 fractionPart  
+    "
+
+    "Modified: / 4.11.1996 / 20:26:54 / cg"
+    "Created: / 28.10.1998 / 17:14:40 / cg"
+!
+
+integerPart
+    "return a float with value from digits before the decimal point
+     (i.e. the truncated value)"
+
+    ^ self truncated asFloat
+
+    "
+     1234.56789 integerPart 
+     1.2345e6 integerPart   
+    "
+
+    "Modified: / 4.11.1996 / 20:26:21 / cg"
+    "Created: / 28.10.1998 / 17:14:56 / cg"
+! !
+
 !Number class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Number.st,v 1.47 1998-08-19 10:54:40 tm Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Number.st,v 1.48 1998-10-28 16:19:13 cg Exp $'
 ! !