numfmt - Maple Help

MapleTA[Builtin]

 numfmt
 format a number according to a template

 Calling Sequence numfmt(format, number)

Parameters

 format - string number - numeric

Description

 • The numfmt command uses a format template to specify how many digits after the decimal point to display among other things. The given number is matched against the template and a formatted string is returned.
 • This command has the same specification as the built-in Java command, java.text.DecimalFormat.

Examples

 > $\mathrm{MapleTA}:-\mathrm{Builtin}:-\mathrm{numfmt}\left("#.00",20.9\right)$
 ${"20.90"}$ (1)
 > $\mathrm{MapleTA}:-\mathrm{Builtin}:-\mathrm{numfmt}\left("#.#",12.34\right)$
 ${"12.3"}$ (2)
 > $\mathrm{MapleTA}:-\mathrm{Builtin}:-\mathrm{numfmt}\left(".#",12.34\right)$
 ${"12.3"}$ (3)
 > $\mathrm{MapleTA}:-\mathrm{Builtin}:-\mathrm{numfmt}\left("#.0000",12.3456789\right)$
 ${"12.3457"}$ (4)
 > $\mathrm{MapleTA}:-\mathrm{Builtin}:-\mathrm{numfmt}\left("#.010",12.3456\right)$
 ${"12.351"}$ (5)
 > $\mathrm{MapleTA}:-\mathrm{Builtin}:-\mathrm{numfmt}\left("#",12.34\right)$
 ${"12"}$ (6)
 > $\mathrm{MapleTA}:-\mathrm{Builtin}:-\mathrm{numfmt}\left("#.#",12.3456\right)$
 ${"12.3"}$ (7)
 > $\mathrm{MapleTA}:-\mathrm{Builtin}:-\mathrm{numfmt}\left("#.###",12.3456\right)$
 ${"12.346"}$ (8)
 > $\mathrm{MapleTA}:-\mathrm{Builtin}:-\mathrm{numfmt}\left("000.#",12.3456\right)$
 ${"012.3"}$ (9)

Compatibility

 • The MapleTA[Builtin][numfmt] command was introduced in Maple 18.