[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] Integer arithmetic
From: |
Tadziu Hoffmann |
Subject: |
Re: [Groff] Integer arithmetic |
Date: |
Thu, 15 Oct 2009 11:18:13 +0200 |
User-agent: |
Mutt/1.5.17 (2007-11-01) |
> 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.
Well, in the simple case above, 0.36 does *not* need to come in
centimeters. It is a simple numerical factor. The "h" already
contains the centimeters. So the solution would be
.nr h 10.55c
.nr w \nh*36/100
.\" .tm \nh \nw
In general: multiply first, then divide. If you get an overflow,
multiply in smaller pieces and add the results (0.36 = 3/10 +
6/100). For example:
.nr w (\nh*3/10)+(\nh*6/100)
- Re: [Groff] Integer arithmetic, (continued)
- 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
- Re: [Groff] Integer arithmetic, Miklos Somogyi, 2009/10/16
- Re: [Groff] Integer arithmetic, Werner LEMBERG, 2009/10/17
- Re: [Groff] Integer arithmetic, walter harms, 2009/10/17
- Re: [Groff] Integer arithmetic, Werner LEMBERG, 2009/10/26
- Re: [Groff] Integer arithmetic, Miklos Somogyi, 2009/10/17
- Re: [Groff] Integer arithmetic, Werner LEMBERG, 2009/10/18
Re: [Groff] Integer arithmetic,
Tadziu Hoffmann <=
Re: [Groff] Integer arithmetic, Denis M. Wilson, 2009/10/19