This is the mail archive of the
mailing list for the GCC project.
Re: G95 Floating point arithmetics without GMP?
- From: Zack Weinberg <zack at codesourcery dot com>
- To: Steven Bosscher <s dot bosscher at student dot tudelft dot nl>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 8 May 2002 12:15:00 -0700
- Subject: Re: G95 Floating point arithmetics without GMP?
- References: <1020883613.750.27.camel@steven>
On Wed, May 08, 2002 at 08:46:52PM +0200, Steven Bosscher wrote:
> For example, g95 can simplify exponentiation expressions (A**B) but
> since C doesn't have that operator, REAL_ARITHMETICS doesn't allow me to
> use eldexp() in real.c (there's no POWER_EXPR tree code).
You should add one.
In general, do not hesitate to add tree codes to tree.def when they
can reasonably express a language-independent concept. POWER_EXPR is
> Another problem I ran into, is that there's no function in real.c to
> calculate log(x). G95 uses McLaurin series for log, and also for sine,
> cosine, and arctangent. I've tried to do this with REAL_ARITHMETICS, but
> I'm not sure if this is correct. I'm not really familiar with floating
> point arithmetics.
Hmm, it would be better to add such routines to real.c and have them
operate directly on the internal floating-point representation. You'd
need LOG_EXPR, SIN_EXPR, COS_EXPR, ARCTAN_EXPR, but that's okay.
I can't help much with details of numerical analysis, sorry.