bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] sin() and cos() return wrong results


From: arnold
Subject: Re: [bug-gawk] sin() and cos() return wrong results
Date: Thu, 18 Oct 2018 22:53:57 -0600
User-agent: Heirloom mailx 12.4 7/29/08

I am glad things fixed themselves. In the future, if you encounter
a bug, instead of a screenshot, please submit a program and data, as
desribed in https://www.gnu.org/software/gawk/manual/html_node/Bugs.html.

Arnold

"winn" <address@hidden> wrote:

> Hi,
>
> I checked angain and saw the results are correct. Last time I got
> incorrect calculation results so I traced the process and saw it happened
> at sin() and cosine() functions. I didn't keep a screenshot.
>
> My system is Windows 10 x64, and I used gawk in Cygwin.
>
> Sorry for the trouble, and thank you all for your kind help.
>
> Charles
>
> ------------------ Original ------------------
> From:  "Andrew J. Schorr"<address@hidden>;
> Date:  Thu, Oct 18, 2018 10:40 PM
> To:  "winn"<address@hidden>;
> Cc:  "bug-gawk"<address@hidden>; 
> Subject:  Re: [bug-gawk] sin() and cos() return wrong results
>
>
>
> Hi,
>
> On Thu, Oct 18, 2018 at 04:53:11PM +0800, winn wrote:
> > I found both sin() and cos() return wrong results in gawk-3.1.8 and 
> > gawk-4.1.3.
> > 
> > 
> > I compared the results with that in Excel, Windows calculator, and Python, 
> > and confirmed this error.
> > 
> > 
> > Please have a check.
>
> Can you please provide some examples of calculations that you think are
> incorrect? At first glance, it seems to work OK:
>
> bash-4.2$ gawk 'BEGIN {pi = atan2(0, -1); print cos(0), sin(0), cos(pi/2), 
> sin(pi/2)}'
> 1 0 6.12323e-17 1
>
> This matches the results in Python 3.7:
>
> bash-4.2$ python3 -c "from math import *; pi = atan2(0,-1); print(cos(0), 
> sin(0), cos(pi/2), sin(pi/2))"
> 1.0 0.0 6.123233995736766e-17 1.0
>
> Regards,
> Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]