summary refs log tree commit diff
path: root/Doc/Zsh/arith.yo
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2014-01-23 10:32:59 +0000
committerPeter Stephenson <pws@zsh.org>2014-01-23 10:32:59 +0000
commit22b8fd6da931657ec930ba2625179c704de3e830 (patch)
tree2266493aa799af7431af9308fd6cb7e088fb668e /Doc/Zsh/arith.yo
parent6c603a412751c810ba04bcd463cd3595091ca391 (diff)
downloadzsh-22b8fd6da931657ec930ba2625179c704de3e830.tar.gz
zsh-22b8fd6da931657ec930ba2625179c704de3e830.tar.xz
zsh-22b8fd6da931657ec930ba2625179c704de3e830.zip
32299: add use of underscores on arithmetic output for spacing
Diffstat (limited to 'Doc/Zsh/arith.yo')
-rw-r--r--Doc/Zsh/arith.yo21
1 files changed, 21 insertions, 0 deletions
diff --git a/Doc/Zsh/arith.yo b/Doc/Zsh/arith.yo
index 2674c7817..4fff28fe2 100644
--- a/Doc/Zsh/arith.yo
+++ b/Doc/Zsh/arith.yo
@@ -76,6 +76,27 @@ have output base 16, while tt(x) (assuming it does not already exist) is
 implicitly typed by the arithmetic evaluation, where it acquires the output
 base 8.
 
+The var(base) may be replaced or followed by an underscore, which may
+itself be followed by a positive integer (if it is missing the value 3
+is used).  This indicates that underscores should be inserted into the
+output string, grouping the number for visual clarity.  The following
+integer specifies the number of digits to group together.  For example:
+
+example(setopt cbases
+print $(( [#16_4] 65536 ** 2 )))
+
+outputs `tt(0x1_0000_0000)'.
+
+The feature can be used with floating
+point numbers, in which case the base must be omitted; grouping
+is away from the decimal point.  For example,
+
+example(zmodload zsh/mathfunc
+print $(( [#_] sqrt(1e7) )))
+
+outputs `tt(3_162.277_660_168_379_5)' (the number of decimal places
+shown may vary).
+
 pindex(C_BASES, use of)
 pindex(OCTAL_ZEROES, use of)
 If the tt(C_BASES) option is set, hexadecimal numbers in the standard C