[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Groff] Integer arithmetic
From: |
Miklos Somogyi |
Subject: |
[Groff] Integer arithmetic |
Date: |
Wed, 14 Oct 2009 22:12:19 +1100 |
Hello, in real world this is sooo easy:
h = 105,5 mm
w = h *0.36
In groff world 105.5 and 0.36 needs to come in centimeters, then some
correction needs to be applied.
Let's say that h is already done and contains roughly 300,000u.
The 0.36 may come as some 10,000 for 0.36c and some 28,000 for 1c with
which we need to divide 0.36c
We have an A * B / C thing to be executed either as (A * B) / C or
(A / C) * B.
The first one may result in an overflow, the second may lose precision.
How do you handle similar problems? Divide B and C with 10? Or with
100 before turning to, say, (A*B)/C?
One can spend too much time on things like this.
Miklos
- [Groff] Integer arithmetic,
Miklos Somogyi <=
- RE: [Groff] Integer arithmetic, Ted Harding, 2009/10/14
- Re: [Groff] Integer arithmetic, Patrik Schindler, 2009/10/15
- Re: [Groff] Integer arithmetic, Werner LEMBERG, 2009/10/15
- Re: [Groff] Integer arithmetic, Patrik Schindler, 2009/10/15
- Re: [Groff] Integer arithmetic, Tadziu Hoffmann, 2009/10/15
- Re: [Groff] Integer arithmetic, Patrik Schindler, 2009/10/15
- Re: [Groff] Integer arithmetic, Tadziu Hoffmann, 2009/10/15
- Re: [Groff] Integer arithmetic, Ted Harding, 2009/10/15
- Re: [Groff] Integer arithmetic, Miklos Somogyi, 2009/10/15
- Re: [Groff] Integer arithmetic, Werner LEMBERG, 2009/10/16