[Gambas-user] Sin(Rad(180)) = ?

vuott at tutanota.com vuott at tutanota.com
Fri Apr 16 16:44:22 CEST 2021


Grazie, Roberto.

-- 
 Inviato in modo sicuro con Tutanota. Ottieni la tua casella di posta elettronica crittografata e senza pubblicità: 
 https://tutanota.com


16 apr 2021, 16:24 da roberto.premoli at tiscali.it:

> On 16/04/21 16:00, vuott--- via User wrote:
>
>> Hello,
>> excuse me, if I'm not mistaken, the sine of 180° = 0.
>>
>> https://en.wikipedia.org/wiki/Sine#Properties_relating_to_the_quadrants <https://en.wikipedia.org/wiki/Sine#Properties_relating_to_the_quadrants>
>>
>> But in Gambas with this:
>>
>>     Sin(Rad(180.0))   I obtain: 1.22464679914735E-16
>>
>> Why ?
>>
>> Regards
>>
> roundig error due to NOT ifinite precision of math processor.
> do as follow:
> parameter = 1000000
> sine = (Int(parameter*Sin(Rad(180.0)))/parameter
>
> this will workaround the problem.
> tune "parameter" to fix precision in calculation
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210416/abcf22ee/attachment.htm>


More information about the User mailing list