chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] Dropping SunCC and Solaris 9


From: Peter Bex
Subject: Re: [Chicken-hackers] Dropping SunCC and Solaris 9
Date: Sun, 21 Apr 2013 16:19:30 +0200
User-agent: Mutt/1.4.2.3i

On Sat, Apr 20, 2013 at 09:25:05PM +0200, Michele La Monaca wrote:
> Indeed it's for an old Solaris version. I'm ok if you don't want to
> include patches for old platforms. Anyway, a correct build for Solaris
> 9 is only a couple of math functions away, so I think it is still
> reasonable. Up to you. I've pasted the patch at
> 
> http://paste.call-cc.org/paste?id=1d9a79658c2bb91f99d7154395ee37d2cdb10bf7
> 
> for users which might need it (very few I guess). It would need some
> tweaking as Florian pointed out but if it's not going to be included I
> don't care about floating numbers.

If you want to make a change, at least test your patches first!
The implementation you posted fails a basic "make check":

Error: assertion failed: (= -43.0 (fpround -42.5))

That's because C's round() is supposed to round away from zero.
(remember: you must install first before "make check" will work)

Our tests for truncate appear to be pretty incomplete.  Your
implementation of trunc passes the tests, but it fails at least
for negative numbers:

#;1> (truncate 1.0)
1.0
#;2> (truncate -1.0)
0.0

A correct version of round looks more like this:

http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/lib/libm/src/s_round.c?rev=1.2&content-type=text/plain&only_with_tag=MAIN

And a correct version of trunc looks like this (I have no idea
if all this bit twiddling is really required):

http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/lib/libm/src/s_trunc.c?rev=1.3&content-type=text/plain&only_with_tag=MAIN

I think all this is a little too complicated to include, just for the
sake of supporting an EOLed platform.  I'll let others decide on whether
it's still worth it.

Cheers,
Peter
-- 
http://www.more-magic.net



reply via email to

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