public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: What is acceptable for -ffast-math? (Was: associative law in combine)
@ 2001-08-01 10:04 dewar
  2001-08-01 10:28 ` Gabriel Dos_Reis
  0 siblings, 1 reply; 10+ messages in thread
From: dewar @ 2001-08-01 10:04 UTC (permalink / raw)
  To: Theodore.Papadopoulo, gdr
  Cc: amylaar, aoliva, dewar, gcc, moshier, torvalds, tprince

<<We're talking here of transformations which we do know able to
drastically change the results.
>>

Words like drastically are not particularly helpful in this discussion,
plain "change" would be just fine.

THe issue is whether the "change" is worth the speed up.

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: What is acceptable for -ffast-math? (Was: associative law in combine)
@ 2001-08-01 10:13 dewar
  2001-08-03 12:26 ` What is acceptable for -ffast-math? Kai Henningsen
  0 siblings, 1 reply; 10+ messages in thread
From: dewar @ 2001-08-01 10:13 UTC (permalink / raw)
  To: tim, torvalds
  Cc: Theodore.Papadopoulo, amylaar, aoliva, dewar, gcc, gdr, moshier, tprince

a/2.0/2.0 will never yield zero if a is non-zero
a/4.0 may indeed yield zero if a is the smallest number

Indeed if one saw a/2.0/2.0 that's pretty peculiar, and it would not be
unreasonable to guess that the properly of not yielding zero was being
exploited :-)

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: What is acceptable for -ffast-math?
@ 2001-08-02 12:07 Jeremy Sanders
  0 siblings, 0 replies; 10+ messages in thread
From: Jeremy Sanders @ 2001-08-02 12:07 UTC (permalink / raw)
  To: gcc

Just writing my thoughts here... I write (and use) a fair amount of
numerical code, mostly in the field of astronomical data
analysis/modelling. The proposals to rewrite slower expressions into
faster ones, eg

a/b/c -> a/(b*c)

would be a very useful one for the time consuming codes we run. This is
especially true for the C++ code I write, which needs significant
optimisation after inlining.

The point is, this would be an option which would be explicitly enabled,
and so there's no problem about breaking IEEE standards. In addition, if
one is writing code to handle numbers on the order of the maximum value in
a float/double, then there's a good argument that these types are
inappropriate. Losing, say, a factor of ten in any direction in a floating
point number wouldn't be a problem! As for the extra errors introduced by
rewriting expressions, this wouldn't be a problem: if one needs total
control over floating point, there's no reason to use -ffast-math!

Jeremy

-- 
Jeremy Sanders <jss@ast.cam.ac.uk>  http://www-xray.ast.cam.ac.uk/~jss/
Pembroke College, Cambridge. UK   Institute of Astronomy, Cambridge. UK


^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: What is acceptable for -ffast-math?
@ 2001-08-03 13:49 dewar
  2001-08-04  1:56 ` Jeremy Sanders
  0 siblings, 1 reply; 10+ messages in thread
From: dewar @ 2001-08-03 13:49 UTC (permalink / raw)
  To: gcc, jss

<<would be a very useful one for the time consuming codes we run.
>>

Do you have measurements, or is this just a guess?

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: What is acceptable for -ffast-math?
@ 2001-08-03 15:00 dewar
  0 siblings, 0 replies; 10+ messages in thread
From: dewar @ 2001-08-03 15:00 UTC (permalink / raw)
  To: gcc, kaih

<<If a is the smallest positive number in some floating point type, then I
would certainly expect both a/2.0 and a/4.0 do the same thing - either
yield zero or signal underflow.
>>

Please review the IEEE standard

(and please remember rounding!)

>>What buggy idea of floating point does this?!

Please make absolutely sure you understand the issue before deciding this
is a bug :-)

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

end of thread, other threads:[~2001-08-04  1:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-01 10:04 What is acceptable for -ffast-math? (Was: associative law in combine) dewar
2001-08-01 10:28 ` Gabriel Dos_Reis
2001-08-01 10:41   ` What is acceptable for -ffast-math? (Was: associative law incombine) Linus Torvalds
2001-08-01 10:55     ` Gabriel Dos_Reis
2001-08-03 12:26   ` What is acceptable for -ffast-math? Kai Henningsen
2001-08-01 10:13 What is acceptable for -ffast-math? (Was: associative law in combine) dewar
2001-08-03 12:26 ` What is acceptable for -ffast-math? Kai Henningsen
2001-08-02 12:07 Jeremy Sanders
2001-08-03 13:49 dewar
2001-08-04  1:56 ` Jeremy Sanders
2001-08-03 15:00 dewar

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