Next: , Previous: , Up: formations   [Index]


52.7 Escape sequences for complex numbers

Format Escape Sequence: ~i

Complex fixed–point float. Parameters: width, decimals, scale, overflowchar, padchar.

Output the argument as a complex number, with both real and imaginary part shown (even if one or both are zero).

The parameters and modifiers are the same as for fixed–point ~f described above. The real and imaginary parts are both output with the same given parameters and modifiers, except that for the imaginary part the @ modifier is always enabled, so as to print a + sign between the real and imaginary parts.

(format #t "~i" 1)  -| 1.0+0.0i

Notice that the imaginary unit character i is excluded from the counting for width and padding.