Changes

Jump to navigation Jump to search

FAQ

316 bytes added, 08:21, 4 March 2013
→‎How do I make Octave use more precision?: Y.T. maximum, not precision; +example
<syntaxhighlight lang="Octave">uint64(18446744073709551610);</syntaxhighlight>
the literal "18446744073709551610" first gets converted to a double precision type, so <code>uint64</code>'s additional precision is lost. Instead, initialise the <code>uint64</code> with smaller numbers and perform a computation to get the larger number you want. E.g.,  <syntaxhighlight lang="Octave">uint64(999999999999999) * 10000</syntaxhighlight> would produce value 9999999999999990000, which is close to the maximum possible value for the uint64 type, but can't be at the moment input directly, doing uint64(9999999999999990000), due to the mentioned error of rounding. 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, [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.
Anonymous user

Navigation menu