Watch this Author's files

More fun with vpi2english if you use, for example,

speak(vpi2english(vpi(2^52)))

The function "speak" is summission File ID: #4769 named "Speak".

There are a also a couple more "speak" submissions around.

Very useful toolbox, especially with the added precision of the vpi toolbox.

I think the demo_fr.m file needs an "echo on" at the beginning to see the header of each of the demo problems, rather than answers only (followed by echo off at the end).

It seems to require vpi to be in the Matlab path, or a previous instance of a vpi.

>> fr(1,7) ??? Error using ==> superiorto Unknown class 'vpi' listed in 'SUPERIORTO'.

Error in ==> fr.fr at 201 superiorto('vpi','double','single','int8','uint8','int16', ...

Another good reason to use higher preciesion: the famous subtractive cancellation error

>> x=77617;y=33096;z=33375*y^6+100*x^2*(11*x^2*y^2-y^6-121*y^4-2)+550*y^8

z = -1.5112e+023

>> x=sym(77617);y=sym(33096);z=33375*y^6+100*x^2*(11*x^2*y^2-y^6-121*y^4-2)+550*y^8

z = -200

>>x=vpa(77617);y=vpa(33096);z=100*x^2*(11*x^2*y^2-y^6-121*y^4-2)+33375*y^6+550*y^8 z = -200.0

>> x=vpi(77617);y=vpi(33096);z=33375*y^6+100*x^2*(11*x^2*y^2-y^6-121*y^4-2)+550*y^8

vpi is as accurate as symbolic and vpa, roughly four times faster than sym and eight times faster than vpa

Contact us