From 40b402bf295e69bc61fa5e511504aa689f4e27eb Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 27 Jun 2005 10:26:13 +0000 Subject: 21387: zcalc documentation for precision features --- ChangeLog | 5 +++++ Doc/Zsh/contrib.yo | 26 +++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 993d8eecd..849594db0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-06-27 Peter Stephenson + + * 21387: Doc/Zsh/contrib.yo: document the precision features + in zcalc. + 2005-05-30 Oliver Kiddle * 21266: Completion/Unix/Command/_mh: improve completion of sequences diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index 9a35c39ff..2686d2983 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -1381,7 +1381,9 @@ An extra facility is provided for changing the default output base. Use, for example, `tt([#16])' to display hexadecimal output preceded by an indication of the base, or `tt([##16])' just to display the raw number in the given base. Bases themselves are always specified in decimal. -`tt([#])' restores the normal output format. +`tt([#])' restores the normal output format. Note that setting an output +base suppresses floating point output; use `tt([#])' to return to normal +operation. The output base can be initialised by passing the option `tt(-#)var(base)', for example `tt(zcalc -#16)' (the `tt(#)' may have to be quoted, depending @@ -1393,6 +1395,28 @@ stored locally in the first element of the array tt(psvar), which can be referred to in tt(ZCALCPROMPT) as `tt(%1v)'. The default prompt is `tt(%1v> )'. +The output precision may be specified within zcalc by special commands +familiar from many calculators: +startitem() +item(tt(norm))( +The default output format. It corresponds to the printf tt(%g) +specification. Typically this shows six decimal digits. +) +item(tt(sci) var(digits))( +Scientific notation, corresponding to the printf tt(%g) output format with +the precision given by var(digits). This produces either fixed point or +exponential notation depending on the value output. +) +item(tt(fix) var(digits))( +Fixed point notation, corresponding to the printf tt(%f) output format with +the precision given by var(digits). +) +item(tt(eng) var(digits))( +Exponential notation, corresponding to the printf tt(%E) output format with +the precision given by var(digits). +) +enditem() + See the comments in the function for a few extra tips. ) findex(zed) -- cgit 1.4.1