### Related

##### round

:lisp (apropos 'round);

:lisp (describe 'fpro...

Calculate

round(5.18889);

Calculate

0.5;

0.05;

0.005;

Calculate

##### round

a:0.00014999999999999...

da:0.0001;

round((a+da^2)/da)*da;

Calculate

round(2432);

Calculate

k : 360 / 2^24;

round(90/k);

Calculate

##### round

a:0.00015;

da:0.0001;

round((a+da^2)/da)*da;

Calculate

##### round-sqrt

round(ratsimple((ln(6...

Calculate

k : 360 / 2^24;

round(45/k);

Calculate

##### round

:lisp (apropos 'round);

Calculate

### round

Run Example
```(%i1)/* perusyhtälöt Ville-symbolisen laskennan tehtäviin */test(x,y,z) := is(abs(x-y) <
z);
(%o1)                 test(x, y, z) := is(abs(x - y) < z)
(%i2) log10(x) := log(x) / log(10);
log(x)
(%o2)                         log10(x) := -------
log(10)
(%i3) err(x,n) := 10^ceiling(log10(x) - n);
ceiling(log10(x) - n)
(%o3)                err(x, n) := 10
(%i4) ans(x,n) := err(x,n) * round(x * 10^(n - ceiling(log10(x))));
n - ceiling(log10(x))
(%o4)      ans(x, n) := err(x, n) 'round(x 10                     )
(%i5) err(123456789,5),numer;
(%o5)                                10000
(%i6) ans(123456789,5),numer;
(%o6)                              123460000
(%i7) ```
Run Example
```plot2d(round(1.5 * (1-cos(6.28318530718*x))), [x,0,1], [y,-1,4]);
plot```
Run Example
```numer:true;
(%o1)                                true
(%i2) ln(x):=log(x)/log(%e);
log(x)
(%o2)                          ln(x) := -------
log(%e)
(%i3) redondeo(num,decimales):=block(       [a:0],   a:round(num*10^decimales)*10^-decimales,    return(a));
(%o3) redondeo(num, decimales) := block([a : 0],
decimales    - decimales
a : 'round(num 10         ) 10           , return(a))
(%i4) biseccion(a,b,expo,N):=block(       [indice:0,bool:true,fa,fp,fb,fafp,TOL,p,er,tabla:matrix(['N,'a,'b,'p,'f('a),'f('b),'f('p),'f('a)*'f('p),'error])],      fa:f(a),   fa:redondeo(fa,expo+2),   TOL:(10)^(-expo),   for i:1 step 1 while (i<
=N and bool=true) do   (      indice:i,      p:((a+b)/2),         p:redondeo(p,expo+2),      fp:f(p),         fp:redondeo(fp,expo+2),      fb:f(b),         fb:redondeo(fb,expo+2),      er:((b-a)/2),         er:redondeo(er,expo+2),      fafp:redondeo(fa*fp,expo+2),            if ( (fa<
0 and fb<
0) or (fa>
0 and fb>
0) ) then      (	           print("No hay cambio de signo"),	 bool:false      ),      tabla:addrow(tabla,[i,a,b,p,fa,fb,fp,fafp,er]),            if ((fp=0) or (er <
TOL)) then      (         print("tolerancia cumplida"),	 bool:false      )      elseif (fafp>
0) then      (         a:p,         fa:fp      )      else      (         b:p      )   ),      if (indice=N) then    (      print(concat("Parametro N=",N," se cumplio. Hay cambios de signo f(a) f(b)")),      print("en las iteraciones hechas.")   ),   display(indice,N),   return(tabla));
(%o4) biseccion(a, b, expo, N) := block([indice : 0, bool : true, fa, fp, fb,
fafp, TOL, p, er, tabla : matrix(['N, 'a, 'b, 'p, 'f('a), 'f('b), 'f('p),
'f('a) 'f('p), 'error])], fa : f(a), fa : redondeo(fa, expo + 2),
- expo
TOL : 10      , for i while (i <= N) and (bool = true)
a + b
do (indice : i, p : -----, p : redondeo(p, expo + 2), fp : f(p),
2
fp : redondeo(fp, expo + 2), fb : f(b), fb : redondeo(fb, expo + 2),
b - a
er : -----, er : redondeo(er, expo + 2), fafp : redondeo(fa fp, expo + 2),
2
if ((fa < 0) and (fb < 0)) or ((fa > 0) and (fb > 0))
then (print("No hay cambio de signo"), bool : false),
tabla : addrow(tabla, [i, a, b, p, fa, fb, fp, fafp, er]),
if (fp = 0) or (er < TOL) then (print("tolerancia cumplida"), bool : false)
elseif fafp > 0 then (a : p, fa : fp) else b : p),
if indice = N then (print(concat("Parametro N=", N,
" se cumplio. Hay cambios de signo f(a) f(b)")),
print("en las iteraciones hechas.")), display(indice, N), return(tabla))
(%i5) f(x):=x-2^-x;
- x
(%o5)                          f(x) := x - 2
(%i6) biseccion(0,1,3,3);
Parametro N=3 se cumplio. Hay cambios de signo f(a) f(b)
en las iteraciones hechas.
indice = 3

N = 3

[ N   a    b      p      f(a)      f(b)     f(p)     f(a) f(p)  error ]
[                                                                     ]
[ 1   0    1     0.5     - 1.0     0.5    - 0.20711   0.20711    0.5  ]
(%o6) [                                                                     ]
[ 2  0.5   1    0.75   - 0.20711   0.5     0.1554    - 0.03218  0.25  ]
[                                                                     ]
[ 3  0.5  0.75  0.625  - 0.20711  0.1554  - 0.02342   0.00485   0.125 ]
(%i7) ```

Help for Round