# [Maxima] Significant Figures and Decimal Places

Stavros Macrakis macrakis at alum.mit.edu
Wed Jun 11 08:19:36 CDT 2008

```To control the number of digits displayed for floating-point numbers, set
fpprintprec.  To calculate to an arbitrary precision, use fpprec and use
bigfloats (with B instead of E for the exponent).

Example:

(%i1) sin(2.3);
(%o1)                           0.74570521217672                <<< regular
floating point
(%i2) fpprintprec:4;
(%o2)                                   4
(%i3) sin(2.3);
(%o3)                                 0.75                   <<< should
really have printed 0.7457
(%i4) sin(2.3b0);
(%o4)                               7.457b-1               <<< bfloats can
have their precision set, but display is also controlled by fpprintprec
(%i5) fpprec:100;
(%o5)                                  100
(%i6) sin(2.3b0);
(%o6)                               7.457b-1          <<< calculated to 100
digits, but displayed to 4 digits
(%i7) fpprintprec:fpprec;
(%o7)                                  100
(%i8) sin(2.3b0);
(%o8)
7.457052121767201773854062116434995389426487780204742575076282805000009931390472578711914171840928876b-1
(%i9) %o4;
(%o9)                        7.457052121767202b-1                   <<< %o4
was calculated to default fpprec (16)
(%i10) %o6;
(%o10)
7.457052121767201773854062116434995389426487780204742575076282805000009931390472578711914171840928876b-1

<<< %o6
was calculated with fpprec=100; here is the full display

On Tue, Jun 10, 2008 at 7:56 AM, Chibisi Chima-Okereke <chibco at gmail.com>
wrote:

> Dear All,
>
> I am a new user to Maxima, and I can't see a function to display numerical
> outputs to a certain number of significant figures or decimal places. I have
> seen the floor, ceiling, and round functions, but was wandering if there is
> something for significant figures or decimal places.
>
> Kind Regards
>
> Chibisi
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
-------------- next part --------------
An HTML attachment was scrubbed...