bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] pi in gawk


From: arnold
Subject: Re: [bug-gawk] pi in gawk
Date: Wed, 15 Feb 2012 03:13:34 -0800

> Date: Wed, 15 Feb 2012 11:13:21 +0100 (CET)
> From: address@hidden
> To: address@hidden
> Cc: Francky Leyn <address@hidden>
> Subject: Re: [bug-gawk] pi in gawk
>
> ----- Oorspronkelijk e-mail -----
> > Hi Arnold,
> > 
> > thanks for the reply.
> > 
> > I use it in a function:
> > 
> > # converion from decimal degrees to degrees, minutes, and seconds
> > function ddmmss(rad) {
> >   pi  = printf ("%.17g\n", atan2(0, -1))
>
> This generates an error:
>
> gawk: cmd. line:15:     pi  = printf("%.17g\n", atan2(0, -1))
> gawk: cmd. line:15:           ^ syntax error
>
> Should it not be sprintf instead of printf?

It should be

        pi = atan2(0, -1)

> >   R2D = 180.0/pi
> >   deg = R2D*rad

As you surmised, these should be set once in the BEGIN section.

Arnold



reply via email to

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