# [Scilab-users] Certain operations are not expressed as floating point

3 messages
Open this post in threaded view
|

## [Scilab-users] Certain operations are not expressed as floating point

 Dear all, Trying to implement sine integral from the series, my first attempt         y = 0         N = 30;         for n=0:N             y = y + (-1)^n * x.^(2*n+1)./(2*n+1)./factorial(2*n+1);         end works fine for x<20. Now I want to vectorize it so the plan is to create a polynomial and then apply horner. The coefficients are coe = (-1).^(0:N)./(1:2:2*N+1)./factorial(1:2:2*N+1) I get coe  =          column 1 to 6    1.  -0.055555555556   0.001666666667  -0.000028344671   0.000000306192  -0.000000002277          column 7 to 19    0.000000000012  -5.09810915D-14   1.65379838D-16   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.          column 20 to 31    0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.         From the 10-th coefficient on, the value seems to be 0. However, coe(10) yields  9.32044813D-22 Actually this is a documented behavior (it is described in hhe format help page). But I wonder if it is advisable, since it may be confusing. Indeed, it took me some time to discover that the coefficients were stored as floating point. At the beginning I "believed" what I saw and started to think which would be the best order of the operations to avoid too small intermediate values. Is there a reason for that behavior that outweighs the inconvenience I've mentioned?  Regards, Federico Miyra   ``` ``` _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users
 Hello, This problem is fixed in Scilab 6.1 S. Le 06/02/2020 à 08:30, Federico Miyara a écrit : Dear all, Trying to implement sine integral from the series, my first attempt         y = 0         N = 30;         for n=0:N             y = y + (-1)^n * x.^(2*n+1)./(2*n+1)./factorial(2*n+1);         end works fine for x<20. Now I want to vectorize it so the plan is to create a polynomial and then apply horner. The coefficients are coe = (-1).^(0:N)./(1:2:2*N+1)./factorial(1:2:2*N+1) I get coe  =          column 1 to 6    1.  -0.055555555556   0.001666666667  -0.000028344671   0.000000306192  -0.000000002277          column 7 to 19    0.000000000012  -5.09810915D-14   1.65379838D-16   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.          column 20 to 31    0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.         From the 10-th coefficient on, the value seems to be 0. However, coe(10) yields  9.32044813D-22 Actually this is a documented behavior (it is described in hhe format help page). But I wonder if it is advisable, since it may be confusing. Indeed, it took me some time to discover that the coefficients were stored as floating point. At the beginning I "believed" what I saw and started to think which would be the best order of the operations to avoid too small intermediate values. Is there a reason for that behavior that outweighs the inconvenience I've mentioned?  Regards, Federico Miyra   ``` ``` ```_______________________________________________ users mailing list [hidden email] https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users ``` ```-- Stéphane Mottelet Ingénieur de recherche EA 4297 Transformations Intégrées de la Matière Renouvelable Département Génie des Procédés Industriels Sorbonne Universités - Université de Technologie de Compiègne CS 60319, 60203 Compiègne cedex Tel : +33(0)344234688 http://www.utc.fr/~mottelet ``` _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users
 Stéphane, Thanks! Federico Miyara On 06/02/2020 04:45, Stéphane Mottelet wrote: Hello, This problem is fixed in Scilab 6.1 S. Le 06/02/2020 à 08:30, Federico Miyara a écrit : Dear all, Trying to implement sine integral from the series, my first attempt         y = 0         N = 30;         for n=0:N             y = y + (-1)^n * x.^(2*n+1)./(2*n+1)./factorial(2*n+1);         end works fine for x<20. Now I want to vectorize it so the plan is to create a polynomial and then apply horner. The coefficients are coe = (-1).^(0:N)./(1:2:2*N+1)./factorial(1:2:2*N+1) I get coe  =          column 1 to 6    1.  -0.055555555556   0.001666666667  -0.000028344671   0.000000306192  -0.000000002277          column 7 to 19    0.000000000012  -5.09810915D-14   1.65379838D-16   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.          column 20 to 31    0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.         From the 10-th coefficient on, the value seems to be 0. However, coe(10) yields  9.32044813D-22 Actually this is a documented behavior (it is described in hhe format help page). But I wonder if it is advisable, since it may be confusing. Indeed, it took me some time to discover that the coefficients were stored as floating point. At the beginning I "believed" what I saw and started to think which would be the best order of the operations to avoid too small intermediate values. Is there a reason for that behavior that outweighs the inconvenience I've mentioned?  Regards, Federico Miyra   ``` ``` ```_______________________________________________ users mailing list [hidden email] https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users ``` ```-- Stéphane Mottelet Ingénieur de recherche EA 4297 Transformations Intégrées de la Matière Renouvelable Département Génie des Procédés Industriels Sorbonne Universités - Université de Technologie de Compiègne CS 60319, 60203 Compiègne cedex Tel : +33(0)344234688 http://www.utc.fr/~mottelet ``` ```_______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users ``` _______________________________________________ users mailing list [hidden email] http://lists.scilab.org/mailman/listinfo/users