Mail Archives: djgpp/1997/02/05/19:14:17
> Myth ? which myth? This is true.
> Try this :
>
> On my 486dx75, this program prints "20 12", which means the calculation
> in floats is about twice slower than the calculation in doubles.
>
> As you can see, there are no fancy functions with prototypes in doubles
> involved, just plain multiplies and adds...
i had to test this one out. couldn't pass up on it ;)
on my p150 your program gave 11 4
pretty good eh? proves your point too. so you must be right.
so then i took the code between the first timer and swapped it with that
between the second timer..
i got..
11 4
:) what you forgot was that gcc had beautifully organised your code to
keep the values from the first part and reuse them in the second part rather
than reload them. so the second timer will always be faster in your code :)
looks like gcc outwitted you and the myth ;)
what you could do is produce the same with inline assembler and the volatile
statement, and *then* see what you get for the timings. but as leathal says,
you'll find theres no difference in speed on a pentium.
having said that, watch out for 80bit floating point stuff on a pentium
as that does have some drawbacks (like being slower and np with loading/
storing)
regards,
nik
--
Graham Tootell
nikki AT gameboutique DOT com
- Raw text -