9front - general discussion about 9front
 help / color / mirror / Atom feed
From: ori@eigenstate.org
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	[thread overview]
Message-ID: <ED1DAED76EA62AA4EFDAFE13D28DA7A9@eigenstate.org> (raw)
In-Reply-To: <63B81FA0C22B408ECFB176AD0AD944E7@a-b.xyz>

> # HG changeset patch
> # User kvik <kvik@a-b.xyz>
> # 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 */



      reply	other threads:[~2020-05-01  2:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01  2:24 kvik
2020-05-01  2:40 ` ori [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ED1DAED76EA62AA4EFDAFE13D28DA7A9@eigenstate.org \
    --to=ori@eigenstate.org \
    --cc=9front@9front.org \
    --cc=kvik@a-b.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).