Fraction.st
changeset 21766 4974e66281d4
parent 20416 dc0f91c47688
child 21819 c62073747a0a
equal deleted inserted replaced
21765:2e5bff2f5a6b 21766:4974e66281d4
    43     integers.
    43     integers.
    44     Fractions are usually created by dividing Integers using / (for exact division).
    44     Fractions are usually created by dividing Integers using / (for exact division).
    45     Notice, that all operations on fractions reduce their result; this means, that
    45     Notice, that all operations on fractions reduce their result; this means, that
    46     the result of a fraction-operation may return an integer.
    46     the result of a fraction-operation may return an integer.
    47     Aka:
    47     Aka:
    48 	(1 / 7) * 7   ->  1  (not 0.99999999...)
    48         (1 / 7) * 7   ->  1  (not 0.99999999...)
    49 
    49 
    50     Mixed mode arithmetic:
    50     Mixed mode arithmetic:
    51 	fraction op fraction    -> fraction/integer
    51         fraction op fraction    -> fraction/integer
    52 	fraction op fix         -> fix; scale is fix's scale
    52         fraction op fix         -> fix; scale is fix's scale
    53 	fraction op integer     -> fraction/integer
    53         fraction op integer     -> fraction/integer
    54 	fraction op float       -> float
    54         fraction op float       -> float
    55 
    55 
    56 
    56 
    57     [classVariables:]
    57     [classVariables:]
    58 	PrintWholeNumbers       Booolean        experimental:
    58         PrintWholeNumbers       Boolean        experimental:
    59 						controls how fractions which are greater than 1 are printed.
    59                                                 controls how fractions which are greater than 1 are printed.
    60 						if true, print them as a sum of an integral and the fractional part.
    60                                                 if true, print them as a sum of an integral and the fractional part.
    61 						(Large ones are easier to read this way)
    61                                                 (Large ones are easier to read this way)
    62 						     (17/3) printString  -> '(5+(2/3))'
    62                                                      (17/3) printString  -> '(5+(2/3))'
    63 						for now, the default is false, for backward compatibility
    63                                                 for now, the default is false, for backward compatibility
    64 
    64 
    65     [author:]
    65     [author:]
    66 	Claus Gittinger
    66         Claus Gittinger
    67 
    67 
    68     [see also:]
    68     [see also:]
    69 	Number
    69         Number
    70 	FixedPoint Float ShortFloat LongFloat Integer Complex
    70         FixedPoint Float ShortFloat LongFloat Integer Complex
    71 "
    71 "
    72 ! !
    72 ! !
    73 
    73 
    74 !Fraction class methodsFor:'instance creation'!
    74 !Fraction class methodsFor:'instance creation'!
    75 
    75