Gri Commands
1: Introduction 2: Simple example 3: Fancy example 4: Running Gri 5: Programming Gri 6: General Issues 7: X-Y Plots 8: Contour Plots 9: Image Plots 10: Examples 11: Handling Data 12: Gri Commands 13: Gri Extras 14: Evolution of Gri 15: Installing Gri 16: Gri Bugs 17: System Tools 18: Acknowledgments 19: License 20: Newsgroup 21: Concept Index |
12.45: The `
|
`sprintf \synonym "format" .variable. [.variable. [...]]' |
sprintf \out "a = %lf b = %.2f" .a. .b.
' - Create a synonym
called `\out
', and print the values of the variables `.a.
' and
`.b.
' into it. If `.a.
' = 1 and `.b.
' = 0.112, then
`\out
' will be `"a = 1 b = 0.11"
'
Formatting codes are as in the C programming language, eg:
%.2f -- Use floating point with 2 decimal places. %9.2f -- As above, but number takes 9 characters. %e -- Use exponential notation. |
"%f"
',
not an integer code like `"%d"
'.