Difference between revisions of "Fractions"
Jump to navigation
Jump to search
(Created page with "You can do computations on fractions in Z3 <pre> FRACTION("1 1/2").add(FRACTION("1 1/2")); FRACTION("1 1/3").subtract(FRACTION("1 1/2")); FRACTION("1 1/3").multiply(FRACTION(...") |
|||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
+ | *[[ Z3 | Z3 Home ]] | ||
+ | *[[ Z%5E3_Language_Documentation | Z3 Language Documentation]] | ||
+ | *[[ Z%5E3_Array_Manipulation_Member_Functions | Listing of Z3 Array Manipulation Member Functions]] | ||
+ | |||
+ | |||
You can do computations on fractions in Z3 | You can do computations on fractions in Z3 | ||
Line 7: | Line 12: | ||
FRACTION("1 1/3").divide(FRACTION("2 5/3")); | FRACTION("1 1/3").divide(FRACTION("2 5/3")); | ||
</pre> | </pre> | ||
+ | |||
+ | z^3 uses the following notation for fractions. 2%%3 for 2/3, (1.2%%3) for 1 2/3 etc. | ||
+ | |||
+ | 5%%5<+>4%%5 | ||
+ | |||
+ | gives 1 4/5 | ||
+ | |||
+ | |||
+ | Note fraction additions etc. uses the Unit Conversion operators such as <+>, <->, etc. Hence it is also possibly to convert to meters etc. | ||
+ | |||
+ | (4%%5)<+>((1%%5)<>m) | ||
+ | |||
+ | gives 1m. | ||
+ | |||
+ | |||
+ | ((4%%5)<+>((1.3%%5)<>m)) | ||
+ | |||
+ | gives 2 2/5m | ||
+ | |||
+ | |||
+ | ((4%%5)<>m)<+>((1.3%%5)<>m) | ||
+ | |||
+ | gives 2 2/5m | ||
+ | |||
+ | |||
+ | (4%%5)<+>((1.3%%5)<>m) | ||
+ | |||
+ | gives 2 2/5m | ||
+ | |||
+ | |||
+ | ((34%%5)<>m)<+>((1.3%%5)<>m) | ||
+ | |||
+ | gives 8 2/5m | ||
+ | |||
+ | |||
+ | ((3.4%%5)<>m)<+>((1.3%%5)<>m) | ||
+ | |||
+ | gives 5 2/5m | ||
+ | |||
+ | |||
+ | (((3.4%%5)<>m)<+>((1.3%%5)<>m))%% | ||
+ | |||
+ | gives 5 2/5m | ||
+ | |||
+ | etc. |
Latest revision as of 01:52, 23 May 2020
You can do computations on fractions in Z3
FRACTION("1 1/2").add(FRACTION("1 1/2")); FRACTION("1 1/3").subtract(FRACTION("1 1/2")); FRACTION("1 1/3").multiply(FRACTION("2 5/3")); FRACTION("1 1/3").divide(FRACTION("2 5/3"));
z^3 uses the following notation for fractions. 2%%3 for 2/3, (1.2%%3) for 1 2/3 etc.
5%%5<+>4%%5
gives 1 4/5
Note fraction additions etc. uses the Unit Conversion operators such as <+>, <->, etc. Hence it is also possibly to convert to meters etc.
(4%%5)<+>((1%%5)<>m)
gives 1m.
((4%%5)<+>((1.3%%5)<>m))
gives 2 2/5m
((4%%5)<>m)<+>((1.3%%5)<>m)
gives 2 2/5m
(4%%5)<+>((1.3%%5)<>m)
gives 2 2/5m
((34%%5)<>m)<+>((1.3%%5)<>m)
gives 8 2/5m
((3.4%%5)<>m)<+>((1.3%%5)<>m)
gives 5 2/5m
(((3.4%%5)<>m)<+>((1.3%%5)<>m))%%
gives 5 2/5m
etc.