In order to show more digits on the screen in Scilab, we can call the "format" command.
Calling Sequence:
format([type],[long])
format()
Parameters
type : character string. "v" for a variable format (default), and "e": for the e-format.
long : integer ( max number of digits (default 10))
In the variable format, a number is shown from the higher order digits to the lower order digits in a natural way. One gets 1 digit less than the [long] he sets. Say one sets [long] = 10, then he get 9 digits on the screen including the point. See the following example.
-->pi = 4*atan(1);
-->format('v',5); pi
pi =
3.14
-->format('v',10); pi
pi =
3.1415927
In the e-format, it seems that the number is shown in scientific notation. The [long] means the length, and one gets one digit less. Since the length includes the point and the exponential part, a number less than 8 does not make sense. See the following examples.
-->format('e',7); pi
pi =
3.1D+00
-->format('e',8); pi
pi =
3.1D+00
-->format('e',9); pi
pi =
3.14D+00
-->format('e',12); pi
pi =
3.14159D+00
format() gives out the current format by 2 numbers. The first number shows the format, 0 for 'v' and 1 for 'e', and the second number shows the length.
Ref: Scilab 4.1.2 browse help.
没有评论:
发表评论