public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* carg, cimag, creal,.. in tgmath.h
@ 2003-06-15 16:49 Andreas Jaeger
  2003-06-15 17:16 ` Ulrich Drepper
  2003-06-16  7:59 ` Ulrich Drepper
  0 siblings, 2 replies; 4+ messages in thread
From: Andreas Jaeger @ 2003-06-15 16:49 UTC (permalink / raw)
  To: GNU libc hacker

[-- Attachment #1: Type: text/plain, Size: 1801 bytes --]



We seem to have bugs with carg, cimag, creal, and fabs: They seem
to handle real arguments wrong according to the Dinkumware folks.
Looking at the implementation, I do not understand what's broken with
fabs, but with carg, cimag and creal we only accept complex arguments.

Here's a patch to fix the c* functions.  Ok to commit?

Andreas

2003-06-15  Andreas Jaeger  <aj@suse.de>

	* math/tgmath.h (carg): Handle real arguments.
	(conj): Likewise.
	(cproj): Likewise.
	(cimag): Likewise.
	(creal): Likewise.

============================================================
Index: math/tgmath.h
--- math/tgmath.h	3 Mar 2003 19:39:31 -0000	1.20
+++ math/tgmath.h	15 Jun 2003 16:45:13 -0000
@@ -421,21 +421,21 @@
 /* Absolute value, conjugates, and projection.  */
 
 /* Argument value of Z.  */
-#define carg(Val) __TGMATH_UNARY_IMAG_ONLY (Val, carg)
+#define carg(Val) __TGMATH_UNARY_REAL_IMAG (Val, carg, carg)
 
 /* Complex conjugate of Z.  */
-#define conj(Val) __TGMATH_UNARY_IMAG_ONLY (Val, conj)
+#define conj(Val) __TGMATH_UNARY_REAL_IMAG (Val, conj, conj)
 
 /* Projection of Z onto the Riemann sphere.  */
-#define cproj(Val) __TGMATH_UNARY_IMAG_ONLY (Val, cproj)
+#define cproj(Val) __TGMATH_UNARY_REAL_IMAG (Val, cproj, cproj)
 
 
 /* Decomposing complex values.  */
 
 /* Imaginary part of Z.  */
-#define cimag(Val) __TGMATH_UNARY_IMAG_ONLY (Val, cimag)
+#define cimag(Val) __TGMATH_UNARY_REAL_IMAG (Val, cimag, cimag)
 
 /* Real part of Z.  */
-#define creal(Val) __TGMATH_UNARY_IMAG_ONLY (Val, creal)
+#define creal(Val) __TGMATH_UNARY_REAL_IMAG (Val, creal, creal)
 
 #endif /* tgmath.h */

-- 
 Andreas Jaeger, SuSE Linux AG, aj@suse.de, http://www.suse.de/~aj
  GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: carg, cimag, creal,.. in tgmath.h
  2003-06-15 16:49 carg, cimag, creal,.. in tgmath.h Andreas Jaeger
@ 2003-06-15 17:16 ` Ulrich Drepper
  2003-06-15 19:00   ` Andreas Jaeger
  2003-06-16  7:59 ` Ulrich Drepper
  1 sibling, 1 reply; 4+ messages in thread
From: Ulrich Drepper @ 2003-06-15 17:16 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: GNU libc hacker

Andreas Jaeger wrote:

> Here's a patch to fix the c* functions.  Ok to commit?

What exactly is wrong.  And cite the standard.

-- 
--------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: carg, cimag, creal,.. in tgmath.h
  2003-06-15 17:16 ` Ulrich Drepper
@ 2003-06-15 19:00   ` Andreas Jaeger
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Jaeger @ 2003-06-15 19:00 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: GNU libc hacker

[-- Attachment #1: Type: text/plain, Size: 879 bytes --]

Ulrich Drepper <drepper@redhat.com> writes:

> Andreas Jaeger wrote:
>
>> Here's a patch to fix the c* functions.  Ok to commit?
>
> What exactly is wrong.  And cite the standard.

From 7.22:
       [#6] For each unsuffixed function in <complex.h> that is not
       a c-prefixed counterpart to  a  function  in  <math.h>,  the
       corresponding  type-generic  macro  has the same name as the
       function.  These type-generic macros are:

            carg          conj          creal
            cimag         cproj

       Use of the macro with any real or complex argument invokes a
       complex function.

The problem is that carg(real float variable) will call the long
double function.

Andreas
-- 
 Andreas Jaeger, SuSE Linux AG, aj@suse.de, http://www.suse.de/~aj
  GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: carg, cimag, creal,.. in tgmath.h
  2003-06-15 16:49 carg, cimag, creal,.. in tgmath.h Andreas Jaeger
  2003-06-15 17:16 ` Ulrich Drepper
@ 2003-06-16  7:59 ` Ulrich Drepper
  1 sibling, 0 replies; 4+ messages in thread
From: Ulrich Drepper @ 2003-06-16  7:59 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: GNU libc hacker

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andreas Jaeger wrote:

> 2003-06-15  Andreas Jaeger  <aj@suse.de>
> 
> 	* math/tgmath.h (carg): Handle real arguments.
> 	(conj): Likewise.
> 	(cproj): Likewise.
> 	(cimag): Likewise.
> 	(creal): Likewise.

I've applied a patch after removing the __TGMATH_UNARY_IMAG_ONLY definition.

- -- 
- --------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+7Xif2ijCOnn/RHQRAnTFAJ4+Gz1Xlyq4SjT6J9/6FYqDbrWt6ACfb3K8
LuvuMm0OenhnfVHRYwG8HRw=
=Ri0o
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-06-16  7:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-15 16:49 carg, cimag, creal,.. in tgmath.h Andreas Jaeger
2003-06-15 17:16 ` Ulrich Drepper
2003-06-15 19:00   ` Andreas Jaeger
2003-06-16  7:59 ` Ulrich Drepper

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 read-only IMAP folder(s) and NNTP newsgroup(s).