From CoCoAWiki
Jump to: navigation, search

<command> <title>Dec</title> <short_description>Pretty Printing of Objects.</short_description>

<syntax> Dec(X:Object, Digits:INT):Object </syntax>

<description> This function prints (rational) numbers within the object X as a floating point number up to Digits Digits. The floating point numbers are represented as strings.

<itemize> <item>@param X The object whose numbers should be printed as floating points. X can be MAT, LIST, POLY, INT, RAT or iteration thereof.</item> <item>@param Digits Gives the exactness of printing.</item> <item>@return The given object with floating point numbers represented as strings instead of (rational) numbers.</item> </itemize>

<example> Use P::=Q[x,y,z];

Dec(1,4); 1

Dec(1/2,4); 0.5

A:=Mat([[17/13, 6/11], [5/3, 1/9]]); Dec(A,4); Mat([

 [<quotes>1.3076</quotes>, <quotes>0.5454</quotes>],
 [<quotes>1.6666</quotes>, <quotes>0.1111</quotes>]








<see>Print On</see>


<key>Dec</key> <key>Print</key> <key>printing</key> <key>float</key> </command>