From john.archie.mckown at gmail.com  Fri Sep  9 19:51:03 2016
From: john.archie.mckown at gmail.com (John McKown)
Date: Fri, 9 Sep 2016 12:51:03 -0500
Subject: [Rd] Different results for tan(pi/2) and tanpi(1/2)
In-Reply-To: <CAML4n3NUKBMtXSt=naEktP4udKruenhG9N-Kdyx=sjpcx-BXvA@mail.gmail.com>
References: <CAML4n3NUKBMtXSt=naEktP4udKruenhG9N-Kdyx=sjpcx-BXvA@mail.gmail.com>
Message-ID: <CAAJSdjjiQnHnPn4qO8goWm-5uvhz9iM7vCBSn2pfs-dU8+9pjg@mail.gmail.com>

On Fri, Sep 9, 2016 at 12:24 PM, Hans W Borchers <hwborchers at gmail.com>
wrote:

> As the subject line says, we get different results for tan(pi/2) and
> tanpi(1/2), though this should not be the case:
>
>     > tan(pi/2)
>     [1] 1.633124e+16
>
>     > tanpi(1/2)
>     [1] NaN
>     Warning message:
>     In tanpi(1/2) : NaNs produced
>
> By redefining tanpi with sinpi and cospi, we can get closer:
>
>     > tanpi <- function(x) sinpi(x) / cospi(x)
>
>     > tanpi(c(0, 1/2, 1, 3/2, 2))
>     [1]    0  Inf    0 -Inf    0
>
> Hans Werner
>
>
>
?When I do a ?tanpi, I see the following:

     ?tanpi(0.5)? is ?NaN?.  Similarly for other inputs with fractional
     part ?0.5?.
?


?I don't know why this is, but apparently the function is working as
documented. Whether that is correct or not is not for me to say.?



-- 
Unix: Some say the learning curve is steep, but you only have to climb it
once. -- Karl Lehenbauer
Unicode: http://xkcd.com/1726/

Maranatha! <><
John McKown

	[[alternative HTML version deleted]]



[Rd] Different results for tan(pi/2) and tanpi(1/2)
John McKown