This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: G95 Floating point arithmetics without GMP?

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
one such.

> 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. 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]