groff
[Top][All Lists]
Advanced

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

Re: [Groff] Floating point arithmetic in groff


From: Tadziu Hoffmann
Subject: Re: [Groff] Floating point arithmetic in groff
Date: Tue, 31 Jan 2006 14:37:19 +0100
User-agent: Mutt/1.5.6i

> Is anyone aware of a means by which floating point arithmetic
> and formating can be computed either within groff or in a
> preprocessor (ala eqn, tbl, etc.)?

Don't know whether this qualifies as "within groff", but you can
always call any of the various system utilities (and it has the
advantage that it can operate on numbers generated within the
groff run, whereas a preprocessor would need the values already
beforehand).  Example:


  .\" unsafe
  .sp 3c
  sqrt(2) =
  .sy dc -e '20k2vp' >system.out
  .so system.out
  .sy dc -e '[.ds xx ]P5k2vp' >system.out
  .so system.out
  .br
  \m[red]\v'-.25m'\D'l 1c 0'\v'.25m'\m[]
  \(<- this is a 1-cm-line
  .br
  \m[red]\v'-.25m'\D'l \*(xxc 0'\v'.25m'\m[]
  \(<- this is a sqrt(2)-cm-line
  .sy rm system.out






reply via email to

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