[comp.sources.d] Formatting numbers in SC 6.8

phs@lifia.imag.fr (Philippe Schnoebelen) (10/01/90)

Is there any way in SC 6.8 to customize the format for displaying values ?
Specifically, in some applications I would like integers to appear without
the ".00" suffix.

--Philippe

[My mail to the authors bounced several times.]

fredb@suphys.physics.su.OZ.AU (R. J. Bassett) (10/03/90)

To customise the format of numbers with sc:
      1. You can change the field-width and precision of entire columns
	(only) using the inbuilt format-changer, the 'f' command.
	This still leaves you in fixed-point notation which may not be what
	you want.
      2. Print the particular cell as a STRING, and use the @fmt()
	function to convert a numeric expression into the displayed string.
	(To get this to work, type back over the leading '"' that sc gives
	you when you issue the '<' or '>' command.)
      3. I wanted sc to revert to exponential notation whenever:
		- a value printed as "0" but was non-zero (ie abs(x)>1e-37)
		- a value overflowed the column width.
	I patched the source code to do this, can send the patch if you like.

toma@hpsad.HP.COM (Tom Anderson) (10/09/90)

> Is there any way in SC 6.8 to customize the format for displaying values ?

I hacked some code into SC that formats numbers in three different ways:
fixed point, floating point, and engineering notation.  I mostly use
engineering notation, which shows the number 1e3 as 1.00k and the
number 1e-11 as 10p.

If there is enough interest (please, mail only) I will attempt to create
a patch and post it.

Tom Anderson      toma@hpsad.hp.com     "It's only hardware"