www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/06/22/15:54:59.2

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3EF60409.FCD867F@phekda.freeserve.co.uk>
Date: Sun, 22 Jun 2003 20:31:21 +0100
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: fpclassify
References: <200306211408 DOT h5LE8iD2022450 AT speedy DOT ludd DOT luth DOT se>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

ams AT ludd DOT luth DOT se wrote:
> Here's a patch to add fpclassify to libc.

Thanks! Mostly looks good. But:

> Note that I kept __attribute((const)) in the texinfo file.
[snip]

I don't think we should keep this in the documentation. I think the
documentation should have the ANSI declaration, if it's an ANSI function (*).
__attribute__((const)) is an implementation detail - a gcc-ism. I'm also don't
think the user cares that it has this attribute. The user may care about
__attribute((noreturn)).

libc seems to use __attribute__, not __attribute. Please use __attribute__ to
be consistent with the rest of the library.

Can you write some tests, please? Maybe you have some, but forgot to include
them.

Out of interest: why did you write this in assembler rather than C? To avoid
the type-punning unions (float_t, etc.)?

I have some documentation corrections:

[snip]
> Index: djgpp/src/libc/c99/math/fpclassd.txh
> ===================================================================
> RCS file: djgpp/src/libc/c99/math/fpclassd.txh
> diff -N djgpp/src/libc/c99/math/fpclassd.txh
> --- /dev/null   1 Jan 1970 00:00:00 -0000
> +++ djgpp/src/libc/c99/math/fpclassd.txh        21 Jun 2003 14:03:16 -0000
> @@ -0,0 +1,43 @@
> +@ignore
> + * File fpclassl.txh.
> + *
> + * Copyright (C) 2003 Martin Str@"omberg <ams AT ludd DOT luth DOT se>.
> + *
> + * This software may be used freely so long as this copyright notice is
> + * left intact. There is no warranty on this software.
> + *
> +@end ignore
> +
> +@node __fpclassifyd, math
> +@findex __fpclassifyd
> +@subheading Syntax
> +
> +@example
> +#include <math.h>
> +
> +int __fpclassifyd(double) __attribute((const));
> +@end example
> +
> +@subheading Description
> +
> +Returns the kind of the floating point value supplied. You should use
> +the type generic macro @code{fpclassify} instead of this 

Can you add a cross-reference, please? E.g. (@pxref{fpclassify}).

> +
> +@subheading Return Value
> +
> +FP_INFINITE, FP_NAN, FP_NORMAL, FP_SUBNORMAL or FP_ZERO.
> +
> +@subheading Portability
> +
> +@portability !ansi-c89, ansi-c99
> +
> +@subheading Example
> +
> +@example
> +if( __fpclassifyf(0.0) != FP_ZERO )

Typo: __fpclassifyf -> __fpclassifyd.

[snip]
> Index: djgpp/src/libc/c99/math/fpclassf.txh
> ===================================================================
> RCS file: djgpp/src/libc/c99/math/fpclassf.txh
> diff -N djgpp/src/libc/c99/math/fpclassf.txh
> --- /dev/null   1 Jan 1970 00:00:00 -0000
> +++ djgpp/src/libc/c99/math/fpclassf.txh        21 Jun 2003 14:03:17 -0000
> @@ -0,0 +1,43 @@
> +@ignore
> + * File fpclassl.txh.
> + *
> + * Copyright (C) 2003 Martin Str@"omberg <ams AT ludd DOT luth DOT se>.
> + *
> + * This software may be used freely so long as this copyright notice is
> + * left intact. There is no warranty on this software.
> + *
> +@end ignore
> +
> +@node __fpclassifyf, math
> +@findex __fpclassifyf
> +@subheading Syntax
> +
> +@example
> +#include <math.h>
> +
> +int __fpclassifyf(float) __attribute((const));
> +@end example
> +
> +@subheading Description
> +
> +Returns the kind of the floating point value supplied. You should use
> +the type generic macro @code{fpclassify} instead of this function.

Can you add a cross-reference, please? E.g. (@pxref{fpclassify}).

[snip]
> Index: djgpp/src/libc/c99/math/fpclassl.txh
> ===================================================================
> RCS file: djgpp/src/libc/c99/math/fpclassl.txh
> diff -N djgpp/src/libc/c99/math/fpclassl.txh
> --- /dev/null   1 Jan 1970 00:00:00 -0000
> +++ djgpp/src/libc/c99/math/fpclassl.txh        21 Jun 2003 14:03:17 -0000
> @@ -0,0 +1,43 @@
> +@ignore
> + * File fpclassl.txh.
> + *
> + * Copyright (C) 2003 Martin Str@"omberg <ams AT ludd DOT luth DOT se>.
> + *
> + * This software may be used freely so long as this copyright notice is
> + * left intact. There is no warranty on this software.
> + *
> +@end ignore
> +
> +@node __fpclassifyld, math
> +@findex __fpclassifyld
> +@subheading Syntax
> +
> +@example
> +#include <math.h>
> +
> +int __fpclassifyld(long double) __attribute((const));
> +@end example
> +
> +@subheading Description
> +
> +Returns the kind of the floating point value supplied. You should use
> +the type generic macro @code{fpclassify} instead of this function.

Can you add a cross-reference, please? E.g. (@pxref{fpclassify}).

> +
> +@subheading Return Value
> +
> +FP_INFINITE, FP_NAN, FP_NORMAL, FP_SUBNORMAL, FP_ZERO or FP_UNNORMAL.
> +
> +@subheading Portability
> +
> +@portability !ansi-c89, ansi-c99
> +
> +@subheading Example
> +
> +@example
> +if( __fpclassifyf(0.0L) != FP_ZERO )

Typo: __fpclassifyf -> __fpclassifyld.

[snip]

Thanks, bye, Rich =]

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019