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:
Name | Vars | Comment |
ulam | - | Basic type of fraction on which everything operates. |
wypisz | ulam | Writes given fraction. |
app | ulam -> ulam | Makes given fraction appropriate, so b |
min | ulam -> ulam | Changes given q into -q. |
mna | ulam,ulam -> boolean | Used in mn - alone doesn't do anything special. |
mn | ulam,ulam -> boolean | Returns TRUE if first number is lower than second. |
adda | ulam,ulam -> ulam | Used in add - alone doesn't do anything special. |
add | ulam,ulam -> ulam | Adds two fractions. |
multi | ulam,ulam -> ulam | Multiplicates two given fractions. |
kwa | ulam -> ulam | Returns a square of a given fraction - a faster way than using multi with equal arguments. |
To see source code of ulamki unit click here.