Stéphane,
This would be great if it worked for any x. When x is close to 1e16
there are few valid numbers per cycle. For instance
x(1) = 1e16
for k=1:5
x(k+1) = nearfloat("succ",x(k));
end
x
yields (with format(25))
10000000000000000.
10000000000000002.
10000000000000004.
10000000000000006.
10000000000000008.
10000000000000010.
Those few numbers have each a definite exact value and sin(x) has also a
definite exact value which seemingly is already well approximated,
unlike what I had previously supposed. For instance
[x sin(x)]
yields
10000000000000000. 0.779688006606978_7_8957
10000000000000002. -0.893837828765730_5_909519
10000000000000004. -0.035752436952928_5_263036
10000000000000006. 0.923594355839355_2_299535
10000000000000008. -0.732949301917758_3_112977
10000000000000010. -0.313565289154332_2_384749
I have underlined the last correct digit compared with Alpha, so it is
the expected result with 16 digits.
Regards,
Federico Miyara
On 06/01/2021 05:49, Stéphane Mottelet wrote:
x = (10^[1:16])*%pi
sx = sin(x-floor(x/2/%pi)*%pi*2)
plot("ln",x,sin(x),'-o',x,sx,'-o')
legend("$\Large\sin x$","$\Large\sin
\left(x-2\pi\left\lfloor\frac{x}{2\pi}\right\rfloor\right)$",3)
--
El software de antivirus Avast ha analizado este correo electrónico en busca de
virus.
https://www.avast.com/antivirus
_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users