6.7.2 Grouping Digits

Long numbers can be hard to read if they have too many digits. For example, the factorial of 30 is 33 digits long! Press d g (calc-group-digits) to enable Grouping mode, in which digits are displayed in clumps of 3 or 4 (depending on the current radix) separated by commas.

The d g command toggles grouping on and off. With a numeric prefix of 0, this command displays the current state of the grouping flag; with an argument of minus one it disables grouping; with a positive argument ‘N’ it enables grouping on every ‘N’ digits. For floating-point numbers, grouping normally occurs only before the decimal point. A negative prefix argument ‘-N’ enables grouping every ‘N’ digits both before and after the decimal point.

The d , (calc-group-char) command allows you to choose any character as the grouping separator. The default is the comma character. If you find it difficult to read vectors of large integers grouped with commas, you may wish to use spaces or some other character instead. This command takes the next character you type, whatever it is, and uses it as the digit separator. As a special case, d , \ selects ‘\,’ (TeX’s thin-space symbol) as the digit separator.

Please note that grouped numbers will not generally be parsed correctly if re-read in textual form, say by the use of C-x * y and C-x * g. (See Kill and Yank Functions, for details on these commands.) One exception is the ‘\,’ separator, which doesn’t interfere with parsing because it is ignored by TeX language mode.