From B.Rowlingson at lancaster.ac.uk  Wed Jul 23 10:24:18 2003
From: B.Rowlingson at lancaster.ac.uk (Barry Rowlingson)
Date: Wed Jul 23 10:24:04 2003
Subject: [Rd] abs() and negative output from fractions() (PR#3536)
In-Reply-To: <Pine.LNX.4.44.0307230843350.26690-100000@gannet.stats>
References: <Pine.LNX.4.44.0307230843350.26690-100000@gannet.stats>
Message-ID: <3F1E4632.7090403@lancaster.ac.uk>

Prof Brian Ripley wrote:
> On Tue, 22 Jul 2003, Duncan Murdoch wrote:

> This is not even a VR bug: no one said abs() is implemented for fractions, 
> and it is not.  From the help page:
> 
>      Arithmetic operations on `"fractions"' objects are possible.
> 
> and abs() is not such an operation.
> 

  Something funny is happening with printing fractions - the values seem 
correct under abs() [and other functions]:

 > xf
[1]    2 -2/5  2/5  2/3
 > abs(xf)
[1]    2 -2/5  2/5  2/3
 > abs(xf)[2]
[1] 2/5

  huh?

 > sqrt(xf)
[1]    2 -2/5  2/5  2/3
Warning message:
NaNs produced in: sqrt(xf)

 > sqrt(xf)[1:4]
[1]   8119/5741         NaN     191/302 38804/47525
Warning message:
NaNs produced in: sqrt(xf)

  Bug, undocumented behaviour, feature? I dont know. It all seems to 
work in 1.6.0, so everyone should downgrade now... :)

Baz


[Rd] abs() and negative output from fractions() (PR#3536)
Barry Rowlingson