The ulamki unit

The ulamki unit is much smaller than bignumber and it should seve as an example of implementating simple arithmetics on rational number representing then as [sign] a b/c where sign is either -1,0 or 1 and all a,b,c are nonnegative integers. This way of thinking is wuite useful when we would like to find certain points in geometric figures e.g. centre of mass. Primarly, this unit was implemented in order to serve as a part of code of implementation of one of the problems for polish olympiad in computing. Luckily, I found an easier way :))) It provides you with such functions:

NameVarsComment
ulam -Basic type of fraction on which everything operates.
wypisz ulamWrites given fraction.
app ulam -> ulamMakes given fraction appropriate, so b
min ulam -> ulamChanges given q into -q.
mna ulam,ulam -> booleanUsed in mn - alone doesn't do anything special.
mn ulam,ulam -> booleanReturns TRUE if first number is lower than second.
adda ulam,ulam -> ulamUsed in add - alone doesn't do anything special.
add ulam,ulam -> ulamAdds two fractions.
multi ulam,ulam -> ulamMultiplicates two given fractions.
kwa ulam -> ulamReturns a square of a given fraction - a faster way than using multi with equal arguments.

To see source code of ulamki unit click here.

MAIN