FAQ: Difference between revisions

1,852 bytes added ,  14 November 2012
Line 473: Line 473:


   set(0, 'defaultfigurevisible', 'off');
   set(0, 'defaultfigurevisible', 'off');
== How do I make Octave use more precision? ==
Octave's default numerical type is IEEE 754 doubles, a.k.a. hardware floats. This type has 52 bits of precision or about 16 decimal digits. It's implemented in your computer's hardware, in your CPU, so it's '''fast'''. This type is assumed throughout for Octave's calculations.
You can use a few other built-in types. The int64 type will have 63 bits of precision. One bit is used for the sign, but if you don't want to lose that bit, uint64 can be used instead. These types, however, cannot represent numbers as large as the default double type, and can only represent integers. Additionally, the symbolic package, when it works, has a vpa() function for variable-precision arithmetic. Note that arbitrary-precision arithmetic is implemented '''in software''' which makes it much slower than hardware floats.
At present, however, the symbolic package is almost useless, since even when you get it to compile and not crash, it cannot handle any array type, which hardly helps for an array-oriented language like Octave. If this limitation is not important to you, attempt to use the symbolic package. If you would like to get this fixed, [http://octave.1599824.n4.nabble.com/Internal-Precision-Symbolic-tp4645257p4645594.html Jordi Gutiérrez Hermoso has volunteered] to fix the package for 5000 USD, which can be obtained from a kickstarter compaign.
Consider carefully if your problem really needs more precision. Often if you're running out of precision the problem lies fundamentally in your methods being [http://en.wikipedia.org/wiki/Numerical_stability numerically unstable], so more precision will not help you here. If you absolutely must use arbitrary-precision arithmetic, you're at present better off using a CAS instead of Octave. An example of such a CAS is [http://sagemath.org Sage].


=Common problems=
=Common problems=