Fraction.st
changeset 1200 cc16f7a00b52
parent 1133 961f2b095c22
child 1264 8d916aa63bce
equal deleted inserted replaced
1199:c37d927155e2 1200:cc16f7a00b52
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
    12 
    13 Number subclass:#Fraction
    13 Number subclass:#Fraction
    14 	 instanceVariableNames:'numerator denominator'
    14 	instanceVariableNames:'numerator denominator'
    15 	 classVariableNames:'FractionOne FractionZero'
    15 	classVariableNames:'FractionOne FractionZero'
    16 	 poolDictionaries:''
    16 	poolDictionaries:''
    17 	 category:'Magnitude-Numbers'
    17 	category:'Magnitude-Numbers'
    18 !
    18 !
    19 
    19 
    20 !Fraction class methodsFor:'documentation'!
    20 !Fraction class methodsFor:'documentation'!
    21 
    21 
    22 copyright
    22 copyright
   266     "return an integer with my value - will usually truncate"
   266     "return an integer with my value - will usually truncate"
   267 
   267 
   268     ^ self asInteger asLargeInteger
   268     ^ self asInteger asLargeInteger
   269 !
   269 !
   270 
   270 
       
   271 asShortFloat
       
   272     "return a shortFloat with (approximately) my value"
       
   273 
       
   274     ^ (numerator asShortFloat) / (denominator asShortFloat)
       
   275 
       
   276     "Created: 17.4.1996 / 12:21:08 / cg"
       
   277 !
       
   278 
   271 coerce:aNumber
   279 coerce:aNumber
   272     "return aNumber converted into receivers type"
   280     "return aNumber converted into receivers type"
   273 
   281 
   274     ^ aNumber asFraction
   282     ^ aNumber asFraction
   275 !
   283 !
   468 ! !
   476 ! !
   469 
   477 
   470 !Fraction class methodsFor:'documentation'!
   478 !Fraction class methodsFor:'documentation'!
   471 
   479 
   472 version
   480 version
   473     ^ '$Header: /cvs/stx/stx/libbasic/Fraction.st,v 1.27 1996-04-02 22:01:58 cg Exp $'
   481     ^ '$Header: /cvs/stx/stx/libbasic/Fraction.st,v 1.28 1996-04-17 10:43:09 cg Exp $'
   474 ! !
   482 ! !
   475 Fraction initialize!
   483 Fraction initialize!