GNU Octave Manual Version 3 by John W. Eaton, David Bateman, Søren Hauberg Paperback (6"x9"), 568 pages ISBN 095461206X RRP £24.95 ($39.95) |
14.2.7 Table of Output Conversions
Here is a table summarizing what all the different conversions do:
- ‘%d’, ‘%i’
-
Print an integer as a signed decimal number. See section 14.2.8 Integer Conversions, for details. ‘%d’ and ‘%i’ are synonymous for
output, but are different when used with
scanf
for input (see section 14.2.13 Table of Input Conversions). - ‘%o’
- Print an integer as an unsigned octal number. See section 14.2.8 Integer Conversions, for details.
- ‘%u’
- Print an integer as an unsigned decimal number. See section 14.2.8 Integer Conversions, for details.
- ‘%x’, ‘%X’
- Print an integer as an unsigned hexadecimal number. ‘%x’ uses lower-case letters and ‘%X’ uses upper-case. See section 14.2.8 Integer Conversions, for details.
- ‘%f’
- Print a floating-point number in normal (fixed-point) notation. See section 14.2.9 Floating-Point Conversions, for details.
- ‘%e’, ‘%E’
- Print a floating-point number in exponential notation. ‘%e’ uses lower-case letters and ‘%E’ uses upper-case. See section 14.2.9 Floating-Point Conversions, for details.
- ‘%g’, ‘%G’
- Print a floating-point number in either normal (fixed-point) or exponential notation, whichever is more appropriate for its magnitude. ‘%g’ uses lower-case letters and ‘%G’ uses upper-case. See section 14.2.9 Floating-Point Conversions, for details.
- ‘%c’
- Print a single character. See section 14.2.10 Other Output Conversions.
- ‘%s’
- Print a string. See section 14.2.10 Other Output Conversions.
- ‘%%’
- Print a literal ‘%’ character. See section 14.2.10 Other Output Conversions.
If the syntax of a conversion specification is invalid, unpredictable things will happen, so don't do this. If there aren't enough function arguments provided to supply values for all the conversion specifications in the template string, or if the arguments are not of the correct types, the results are unpredictable. If you supply more arguments than conversion specifications, the extra argument values are simply ignored; this is sometimes useful.
ISBN 095461206X | GNU Octave Manual Version 3 | See the print edition |