The following problem with vpa (variable precision arithmetic)
occurs only in octave-4.0.1 win10 32b version and not in the linux
64b version. As you can see, the number "1/3" is inaccurately
represented when digits is greater than 16 (which happens to be
roughly the native precision of a double, and perhaps that is not
a coincidence).

I wanted to try this also in octave-4.0.2, but I had trouble
installing the symbolic package (contains vpa function) .

Any thoughts on what is going on here?

----------------------------------------------------------------------------------------------------------------

%this is in win10 64b with octave 4.0.1 32b for windows (not
cygwin version, not 64b version)

>> pkg load symbolic

>> x=vpa(1/3,21)

OctSymPy v2.4.0: this is free software without warranty, see
source.

Initializing communication with SymPy using a popen2() pipe.

Using winwrapy.bat workaround for bug #43036 (Octave <= 4.0.2,
on Windows)

Some output from the Python subprocess (pid 968) might appear
next.

OctSymPy: Communication established. SymPy v1.0.

Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25) [MSC
v.1900 64 bit (AM

D64)]

x = (sym) 0.333333333333333314830

>> x=vpa(1/3,19)

x = (sym) 0.3333333333333333148

>> x=vpa(1/3,30)

x = (sym) 0.333333333333333314829616256247

>> x=vpa(1/3,20)

x = (sym) 0.33333333333333331483

>> x=vpa(1/3,10)

x = (sym) 0.3333333333

>> x=vpa(1/3,15)

x = (sym) 0.333333333333333

>> x=vpa(1/3,16)

x = (sym) 0.3333333333333333

>> x=vpa(1/3,17)

x = (sym) 0.33333333333333331

>> version

ans = 4.0.1

>> uname

ans =

scalar structure containing the fields:

sysname = MINGW32_NT-6.2

nodename = *

release = Windows 6.2

version =

machine = i686

This is the python version I use

Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:54:25) [MSC
v.1900 64 bit (AMD64)] on win32

Type "help", "copyright", "credits" or "license" for more
information.

>>>

----------------------------------------------------------------------------------------------------------------

_______________________________________________

Help-octave mailing list

[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave