Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2006-10

speed of real calculations

7 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marc Santhoff

Hi,

is anyone aware of or has done a calculations speed comparison for the four float types (single, double, extended, comp)?

I'm most interested in the first rules of arithmetic.

TIA,
Marc

Reply by email

Jonas Maebe
to Marc Santhoff
Marc Santhoff wrote
is anyone aware of or has done a calculations speed comparison for the four float types (single, double, extended, comp)?

For the x87, the only difference can come from cache misses/hits due to the different sizes they take up in memory, because the x87 performs all calculations using either extended (the default in FPC) or double precision (user-settable).

Jonas

Reply by email

Florian Klaempfl
to Jonas Maebe
Jonas Maebe wrote 10 lines
On 18 okt 2006, at 08:31, Marc Santhoff wrote: > is anyone aware of or has done a calculations speed comparison for the > four float types (single, double, extended, comp)? For the x87, the only difference can come from cache misses/hits due to the different sizes they take up in memory, because the x87 performs all calculations using either extended (the default in FPC) or double precision (user-settable).

You can set it also to single. But these settings affect only division, roots and other complex operations.

Reply by email

Marc Santhoff
to Florian Klaempfl
Florian Klaempfl wrote 11 lines
Jonas Maebe wrote: > > On 18 okt 2006, at 08:31, Marc Santhoff wrote: > >> is anyone aware of or has done a calculations speed comparison for the >> four float types (single, double, extended, comp)? > > For the x87, the only difference can come from cache misses/hits due to > the different sizes they take up in memory, because the x87 performs all > calculations using either extended (the default in FPC) or double > precision (user-settable).

I read this as "any float calculation is done by using x87 copro". Good to know, so bigger is better in this case.

The only concern left is the question for other CPUs, but in fact the main target is x86.

(Note to myself: have a lok at fpc generated assembler and cpu structures)

You can set it also to single. But these settings affect only division, roots and other complex operations.

Divisions do make a difference for me. How can this setting be made, is there a compiler sitch involved or some symbol to define?

Thanks so far,
Marc

Reply by email

Jonas Maebe
to Marc Santhoff
Marc Santhoff wrote
Divisions do make a difference for me. How can this setting be made, is there a compiler sitch involved or some symbol to define?

http://community.freepascal.org:10000/docs-html/rtl/math/ setprecisionmode.html

Always check the result, since on architectures where this cannot be changed you will get back whatever is used. On other architectures, like PPC, the precision simply depends on the arguments and cannot be changed at run time.

Jonas

Reply by email

Marc Santhoff
to Jonas Maebe
Jonas Maebe wrote 13 lines
On 18 okt 2006, at 11:20, Marc Santhoff wrote: > Divisions do make a difference for me. How can this setting be > made, is > there a compiler sitch involved or some symbol to define? http://community.freepascal.org:10000/docs-html/rtl/math/ setprecisionmode.html Always check the result, since on architectures where this cannot be changed you will get back whatever is used. On other architectures, like PPC, the precision simply depends on the arguments and cannot be changed at run time.

Ah, this was the missing part. I have thought all of this was implemented only inside the compiler itself ...

Many thanks,
Marc

Reply by email

Jonas Maebe
to Marc Santhoff
Marc Santhoff wrote
Ah, this was the missing part. I have thought all of this was implemented only inside the compiler itself ...

It is, except for x86 where the compiler is not involved with the precision used by the FPU since there are no different opcodes.

Jonas

Reply by email