pspp-dev
[Top][All Lists]
Advanced

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

Re: trunc


From: John Darrington
Subject: Re: trunc
Date: Sun, 26 Nov 2006 07:48:50 +0800
User-agent: Mutt/1.5.4i

On Sat, Nov 25, 2006 at 05:40:08PM -0500, Jason Stover wrote:
     BSD's math.h has no 'trunc', but both GNU and BSD have
     'floor' in math.h, so to fix this error on BSD:
     
     src/language/stats/chisquare.c:78: undefined reference to `trunc'
     
     could we use floor instead?

trunc and floor do different things if the argument is negative.

According to the user documentation, "Non-integer values are
truncated before classification". I interpret this to mean "towards
zero".
I suppose the most portable way is to cast to int and back again, but
it's not very nice.

J'


-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.


Attachment: pgp5iYhFk3jCl.pgp
Description: PGP signature


reply via email to

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