Overblog Suivre ce blog
Editer l'article Administration Créer mon blog
24 août 2011 3 24 /08 /août /2011 04:36

Preliminaries:

Octave is a just great free software, very good alternative to the expensive Matlab.

It does not handle multiprecision (to keep it simple, let's say that multiprecision is computation

with very high precision).

Aribas is a GNU free tool for multiprecision.

This page presents a simple tool for using Aribas within Octave.

 

Keywords:

- Fractals

- Multiprecision, high precision computing

- Opensource software (Octave, Aribas)

- Buggy source code

 

Why multiprecision matters ?

Sometimes, computation errors cumulate until reaching a very significant level.

It is widely claimed that the satelite-lifting rocket Ariane 5 exploded due to computation errors

(see www.intel.com/standards/floatingpoint.pdf  for more on this example and other examples).

 

Download:

you just have to put the following lines in a file "aribas_eval.m",

in the exec path of octave:

============ aribas_eval.m ===================

function r=aribas_eval(s)
  n=round(rand*10000);m=round(rand*10000);
  chaine=(sprintf('echo "%s.\nexit" | sed ''s/\\^/**/g'' > /tmp/test%d%d.ari ',s,n,m));
 system(chaine);
  system(sprintf("aribas -b /tmp/test%d%d.ari | tail -1 |sed 's/_//g' > /tmp/testb%d%d.ari",n,m,n,m));
  r=load(sprintf('/tmp/testb%d%d.ari',n,m));
 system(sprintf('rm /tmp/test%d%d.ari /tmp/testb%d%d.ari',n,m,n,m));
end

==============================================

 

How to use:

- Write your code with the Octave "eval" function for the computations that you want to see in multiprecision.

- Check that it works

- Replace "eval" by "aribas_eval"

     ==> this is supposed to be a multiprecision version

     ==> however, there are plenty of bugs

 

Example:

mod(eval("(2**250)-1"),256)

    returns 0 (which is wrong --- precision error)

mod(aribas_eval("(2**250)-1"),256)

    returns 255 (which is ok)

 

Important remarks:

- no guarantee

- known bugs: handles only a very small subset of Octave's function

- this will be maintained and improved only as long as there is no better such functionality in Octave

- if you know a better way for doing this in octave just tell me and this page will disappear

 

Contacts:

   olivier . teytaud

      at  gmail . com

I am the only responsible of any mistake in the code. The code is not guaranteed, it is even not guaranteed to do

anything which is useful for anyone - if you use it, you have to check yourself that it is ok for you.

The code is completely free (free code, free of charge).

Partager cet article

Repost 0
Published by teytaud - dans Informatique
commenter cet article

commentaires