Subversion Repositories wimsdev

Rev

Rev 1941 | Rev 4121 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1941 bpr 1
!if $wims_read_parm!=slib_header
2
 !goto proc
3
!endif
4
slib_title=Calculate an interval for the answer type range
5
slib_parms=3\
6
,a real\
7
3,number of significative digits\
8
1,tolerance on the last significative digit
9
slib_author=Bernadette Perrin-Riou
10
slib_out=three numbers for the answer type range : minimum, maximum, real with the number of significative digits,\
11
an error of +/- "tolerance" on the last number is allowed (calculated with the given real).
12
slib_example=234765\
13
0.006543\
14
45.987543,5,10
3265 bpr 15
slib_require=pari
1941 bpr 16
!exit
17
 
18
:proc
19
!distribute items $wims_read_parm into slib_r,slib_app,slib_tol
20
!default slib_app=3
21
!default slib_tol=1
22
slib_r_approx=!exec pari (f(r,n)= l=if(r != 0, floor(log(abs(r))/log(10)),1) ; s =round(10^(-l+n-1)*r) ; [l,s]) ; \
23
   f($slib_r,$slib_app)
24
slib_r_app=$[$(slib_r_approx[2])*10^(-$slib_app+1+$(slib_r_approx[1]))]
25
slib_out=!exec pari slib_err=$slib_tol*10^(-$slib_app+1+$(slib_r_approx[1])) ; 1.*[$slib_r_app-slib_err,$slib_r_app+slib_err]
26
 
27
slib_out=$slib_out,$slib_r_app