|
Format
|
Built-in function
|
|
Format is used to print a floating point number with a specified number of places of precision. The function returns a string containing the appropriate representation of the number. 'width' is the total length of the number string, 'places' is the number of decimal places to be printed. Format (x,width,places) is equivalent to sprintf ("%width.placesf",x);
|
Syntax
|
Format (x,width,places);
|
Notes
|
'width' should be a non-negative integer. Set width to 0 not to fix the total length.
'places' should be a non-negative integer. Set places to 0 to display the default number of decimal places.
|
Examples
|
x = 3.141516; fprintf (stdout, Format (x,5,2));// result: " 3.14"
|
|
Last modified: 5/11/2000 |
|
|