5Fermer7
PpHdLe 15/05/2010 à 15:50
Ok, il est vrai qu'en toute rigueur, j'aurais du dire quasi-garantie pour approx.
En pratique, ton exemple, par contre, marche sans aucun problème :
$ prec(8)
53
$ approx(1.05+0.05,2)
1.1E0

Et je rappelle que ce n'est pas limité à faire de l'arithmétique décimale, mais permet d'approximer n'importe quoi (sauf fonctions spéciales + trigonométriques).


Je cite la doc de may pour commencer à comprendre pourquoi ca marche :

int may_kernel_num_presimplify (int flag ) [Function]
When you parse strings, the float numbers may be evaluated to the current precision if flag is
set, or they may be stored as float-string, without evaluating them with the current precision:
we delay the evaluation to a later step where we know the needed precision. Set the current
value of this flag. Return the previous used flag. The default is 1, e.g. we evaluate the float
at parsing time.