ba_sprintf

Definition: string s = ba_sprintf(sequence fmt, bigatom N)
Description: Get formatted string (%B) representation of a bigatom.

Similar to sprintf(), except that it replaces a single %B formatting specification.

The format string is formally declared as follows:

fmt = '%' ['+'] [fchar] [size] [['.'] ['0'] [decs] ['a' | [char] 'c'] ['e'|'E'] ] 'B'

where '+' means always put the sign,
fchar, if not '1'..'9', is the fill character,
size is the minimum size of the integer portion of the number,
'.' merely serves to separate the parts of the format string
decs is the maximum number of decimals to show
'a' zero fills decimal places,
'c' (ignored if size not specified) allows an alternate fill character
'e' use exponential format, with an 'e'
'E' use exponential format, with an 'E'
Comments: The original author notes this is somewhat ad-hoc and possibly deserves to be rewritten. You may need to experiment a little to get things right. I could only find a few example uses, and will freely admit to not being very sure about the ['0'] ['a' | [char] 'c'] bits.

ba_printf() is a simple wrapper of ba_sprintf(), with an additional file parameter at the start.
Example:
include bigatom.e
{} = ba_scale(50)
bigatom ba = ba_sqrt(2)
ba_printf(1,"The square root of 2 with 50 decimals is:%.50aB\n",ba)
-- The square root of 2 with 50 decimals is:1.41421356237309504880168872420969807856967187537694