groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

## [Groff] About numerical precision

 From: Thomas Baruchel Subject: [Groff] About numerical precision Date: Wed, 2 Apr 2003 13:24:35 +0200 User-agent: Mutt/1.2.5i

```Brest, le mercredi 2 avril

Hi, I am re-writing my personal macros in a cleaner way. I have a trouble
for the following purpose. I want to implement Adobe specification on
building a SmallCaps font from a regular one, by using \s and \H escape
sequences. But of course, groff isn't a mathematical arbitrary precision
tool :-( I want to keep at least 1 correct digit in the final numerical
value, which is a quite modest purpose (but I really want it, because
10.5 isn't the same than 10 for my purpose).

Here are the specifications and the way I am implementing it.
horizontal scale = .9
vertical scale = ((X-x)/3+x)/X
where x is the height of current x and X the height of current X
OK for the horizontal scale:
\s[9*\\n(.s/10]    \\ instead of \ for obvious context reasons

BUT for the vertical scaling:
I need in fact ((X-x)/3+x)/X*s   with s = \\n(.s
as an argument for \H escape sequence

I have very easely (X-x)/3+x with a good precision in scaled points.
For instance, calling my macro with Minion-Regular 72,
having x = 31248
X = 46800
I get (X-x)/3+x = 36432   (ie. 36.432p)
which is what I expected

But, I can't manage to get \H'36432*72/46800' without any
error: \H'\\nY*\\n(.s/\\nX' produces a multiplication overflow

and \H'36432/46800*72' seems to produce some \H'0' for obvious precision
reasons.

Any idea ?

--
Deux choses remplissent le coeur d'une admiration et d'une vénération
toujours nouvelles et toujours croissantes, à mesure que la réflexion
s'y attache et s'y applique : le ciel étoilé au-dessus de moi et la loi
morale en moi. (Emmanuel Kant)
```

reply via email to

 [Prev in Thread] Current Thread [Next in Thread]