Jump to navigation Jump to search


13 bytes added, 09:53, 29 November 2012
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. Furthermore, there is no way to represent integer literals, so if you do  <syntaxhighlight lang="Octave">uint64(18446744073709551610);</syntaxhighlight>,  the literal "18446744073709551610" first gets converted to a double precision type, so <code>uint64</code>'s additional precision gets lostsis lost. Alternatively, 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, [ Jordi Gutiérrez Hermoso has volunteered] to fix the package for 5000 USD, which can be obtained from a kickstarter compaign.

Navigation menu