Fraction.st
changeset 2140 5e2def558185
parent 1893 c66af5c46272
child 2789 e3e8707d26b4
equal deleted inserted replaced
2139:54ab2e1f4d93 2140:5e2def558185
   334     "
   334     "
   335 
   335 
   336     "Created: 5.11.1996 / 15:15:54 / cg"
   336     "Created: 5.11.1996 / 15:15:54 / cg"
   337 !
   337 !
   338 
   338 
       
   339 asFixedPoint:scale
       
   340     "return the receiver as fixedPoint number, with the given number
       
   341      of post-decimal-point digits."
       
   342 
       
   343     ^ FixedPoint numerator:numerator denominator:denominator scale:scale
       
   344 
       
   345     "
       
   346      (1/2) asFixedPoint:2 
       
   347      (1/3) asFixedPoint:2 
       
   348      (1/3) asFixedPoint:5 
       
   349      (2/3) asFixedPoint:2 
       
   350      (2/3) asFixedPoint:5 
       
   351     "
       
   352 
       
   353     "Created: 5.11.1996 / 15:15:54 / cg"
       
   354     "Modified: 10.1.1997 / 19:54:50 / cg"
       
   355 !
       
   356 
   339 asFloat
   357 asFloat
   340     "return a float with (approximately) my value"
   358     "return a float with (approximately) my value"
   341 
   359 
   342     ^ (numerator asFloat) / (denominator asFloat)
   360     ^ (numerator asFloat) / (denominator asFloat)
   343 !
   361 !
   628 ! !
   646 ! !
   629 
   647 
   630 !Fraction class methodsFor:'documentation'!
   648 !Fraction class methodsFor:'documentation'!
   631 
   649 
   632 version
   650 version
   633     ^ '$Header: /cvs/stx/stx/libbasic/Fraction.st,v 1.35 1996-11-05 18:39:52 cg Exp $'
   651     ^ '$Header: /cvs/stx/stx/libbasic/Fraction.st,v 1.36 1997-01-10 18:55:08 cg Exp $'
   634 ! !
   652 ! !
   635 Fraction initialize!
   653 Fraction initialize!