From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mimir.eigenstate.org ([206.124.132.107]) by ewsd; Thu Apr 30 22:40:50 EDT 2020 Received: from abbatoir.fios-router.home (pool-162-83-132-245.nycmny.fios.verizon.net [162.83.132.245]) by mimir.eigenstate.org (OpenSMTPD) with ESMTPSA id 9fe75dce (TLSv1.2:ECDHE-RSA-AES256-SHA:256:NO); Thu, 30 Apr 2020 19:40:35 -0700 (PDT) Message-ID: To: kvik@a-b.xyz, 9front@9front.org Subject: Re: [9front] [PATCH] ape: deduplicate math.h Date: Thu, 30 Apr 2020 19:40:34 -0700 From: ori@eigenstate.org In-Reply-To: <63B81FA0C22B408ECFB176AD0AD944E7@a-b.xyz> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: managed distributed wrapper wrapper > # HG changeset patch > # User kvik > # Date 1588298259 -7200 > # Node ID b271122228598529da2213778831288224dea984 > # Parent 8006152d13d23a98ab072a4b656af2612baea3aa > ape: deduplicate math.h > > This merges all of /$objtype/include/ape/math.h into > /sys/include/ape/math.h. > > All headers were exactly the same except some didn't implement > isnan(x) and isinf(x), or they weren't passing the sign > parameter to isInf(d, sign). Generally LGTM. Two comments: > -#endif /* __MATH */ > diff -r 8006152d13d2 -r b27112222859 sys/include/ape/math.h > --- /dev/null Thu Jan 01 00:00:00 1970 +0000 > +++ b/sys/include/ape/math.h Fri May 01 03:57:39 2020 +0200 > @@ -0,0 +1,79 @@ > +#ifndef __MATH > +#define __MATH > +#pragma lib "/$M/lib/ape/libap.a" > + > +/* a HUGE_VAL appropriate for IEEE double-precision */ > +/* the correct value, 1.797693134862316e+308, causes a ken overflow */ > +#define HUGE_VAL 1.79769313486231e+308 > + > +#ifdef __cplusplus > +extern "C" { > +#endif Fat chance. > +extern double fmin(double, double); > + > +#ifdef _RESEARCH_SOURCE Looks the stuff inside this ifdef are standardized: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf, section 7.12 https://pubs.opengroup.org/onlinepubs/7908799/xsh/math.h.html We should probably drop the _RESEARCH_SOURCE ifdef. > +/* does >> treat left operand as unsigned ? */ > +#define Unsigned_Shifts 1 > +#define M_E 2.7182818284590452354 /* e */ > +#define M_LOG2E 1.4426950408889634074 /* log 2e */ > +#define M_LOG10E 0.43429448190325182765 /* log 10e */ > +#define M_LN2 0.69314718055994530942 /* log e2 */