public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "ghazi at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/29335] transcendental functions with constant arguments should be resolved at compile-time Date: Sat, 28 Oct 2006 13:29:00 -0000 [thread overview] Message-ID: <20061028132856.6592.qmail@sourceware.org> (raw) In-Reply-To: <bug-29335-578@http.gcc.gnu.org/bugzilla/> ------- Comment #19 from ghazi at gcc dot gnu dot org 2006-10-28 13:28 ------- (In reply to comment #18) > (In reply to comment #17) > > Yes, I can reproduce the NaN. In fact, any negative value > > gives a NaN. > Not any negative value, but in lngamma.c: > /* if x < 0 and -2k-1 <= x <= -2k, then lngamma(x) = NaN */ > probably because the gamma value is negative. This is because MPFR defines > lngamma as log(gamma(x)) while the C standard defines it as log|gamma(x)|. I > wonder if this should be regarded as a bug or if a new function (say, > mpfr_lgamma) should be defined in MPFR (in which case, not before 2.3.0). The documenation in MPFR says: -- Function: int mpfr_lngamma (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND) Set ROP to the value of the Gamma function on OP, and its logarithm respectively, rounded in the direction RND. When OP is a negative integer, NaN is returned. It only talked about negative integers, and I glossed over the fact that it left out the absolute value that C does. So it was pilot error, but I think a clarification would help. Many times in the docs MPFR takes pains to follow the C99 standard, e.g. the inputs to atan2 or pow. Where you deviate from it should also be noted. Or you could consider it a bug and fix it. :-) Anyway, I think I can hand wrap mpfr_log(mpfr_abs(mpfr_gamma)) myself right? > Also, warning! The mpfr_erfc is incomplete for x >= 4096: There is an infinite > loop in the 2.2 branch. This problem is now detected in the trunk, and until > this is completely fixed, a NaN is returned with the MPFR erange flag set. This > should be in the 2.2 branch in a few days (and a preversion of MPFR 2.2.1 will > come several days after that). If it returns NaN for now that's fine since GCC avoids any transformation that returns NaN or Inf. Glad to hear a new version is coming out. If you make a prerelease tarball available somewhere I'd like to try it with mainline GCC. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29335
next prev parent reply other threads:[~2006-10-28 13:29 UTC|newest] Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-10-03 16:48 [Bug middle-end/29335] New: " ghazi at gcc dot gnu dot org 2006-10-05 5:11 ` [Bug middle-end/29335] " pinskia at gcc dot gnu dot org 2006-10-05 17:54 ` kargl at gcc dot gnu dot org 2006-10-06 13:25 ` ghazi at gcc dot gnu dot org 2006-10-06 14:40 ` kargl at gcc dot gnu dot org 2006-10-06 15:36 ` ghazi at gcc dot gnu dot org 2006-10-06 17:03 ` kargl at gcc dot gnu dot org 2006-10-07 2:05 ` ghazi at gcc dot gnu dot org 2006-10-07 14:08 ` ghazi at gcc dot gnu dot org 2006-10-09 17:16 ` ghazi at gcc dot gnu dot org 2006-10-14 16:12 ` ghazi at gcc dot gnu dot org 2006-10-14 16:14 ` ghazi at gcc dot gnu dot org 2006-10-20 15:54 ` ghazi at gcc dot gnu dot org 2006-10-23 20:25 ` ghazi at gcc dot gnu dot org 2006-10-24 17:45 ` ghazi at gcc dot gnu dot org 2006-10-25 20:44 ` ghazi at gcc dot gnu dot org 2006-10-28 3:20 ` ghazi at gcc dot gnu dot org 2006-10-28 3:48 ` sgk at troutmask dot apl dot washington dot edu 2006-10-28 9:07 ` vincent at vinc17 dot org 2006-10-28 13:29 ` ghazi at gcc dot gnu dot org [this message] 2006-10-28 14:06 ` vincent at vinc17 dot org 2006-10-28 16:04 ` ghazi at gcc dot gnu dot org 2006-10-28 16:58 ` vincent at vinc17 dot org 2006-10-29 2:02 ` ghazi at gcc dot gnu dot org 2006-10-30 20:22 ` ghazi at gcc dot gnu dot org 2006-10-31 3:14 ` ghazi at gcc dot gnu dot org 2006-10-31 9:55 ` vincent at vinc17 dot org 2006-10-31 20:09 ` ghazi at gcc dot gnu dot org 2006-10-31 22:15 ` vincent at vinc17 dot org 2006-11-02 3:21 ` ghazi at gcc dot gnu dot org 2006-11-02 14:41 ` ghazi at gcc dot gnu dot org 2006-11-02 15:57 ` vincent at vinc17 dot org 2006-11-02 22:44 ` ghazi at gcc dot gnu dot org 2006-11-05 23:27 ` vincent at vinc17 dot org 2006-11-07 2:46 ` ghazi at gcc dot gnu dot org 2006-11-30 19:45 ` chaoyingfu at gcc dot gnu dot org 2006-12-18 14:54 ` ghazi at gcc dot gnu dot org 2006-12-26 19:03 ` ghazi at gcc dot gnu dot org 2006-12-26 19:13 ` ghazi at gcc dot gnu dot org 2007-01-20 0:33 ` ghazi at gcc dot gnu dot org 2007-01-31 15:06 ` ghazi at gcc dot gnu dot org [not found] <bug-29335-4@http.gcc.gnu.org/bugzilla/> 2014-02-16 10:00 ` jackie.rosen at hushmail dot com
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=20061028132856.6592.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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: linkBe 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 read-only IMAP folder(s) and NNTP newsgroup(s).