Recent

Author Topic: Single / Double / Float speed on x86_64  (Read 1765 times)

BrunoK

  • Hero Member
  • *****
  • Posts: 762
  • Retired programmer
Re: Single / Double / Float speed on x86_64
« Reply #15 on: December 12, 2025, 06:12:52 pm »
in the case of the sin function, the sum from -N to N should be zero, so the closer to zero the more accurate
What does represent the sum of xsin, what should it be ?

If both should be 0 then sum of sin is better in C but xsin is better in FPC 3.2.2 and above.

In FPC, if you use Linux 64 bit, you get the floating point unit x87 FPU Extended precision (80 bit extended) calculation but if using Win 64, you get Double floating ) point (64 bit double) calculation. So what is it you want ?

srvaldez

  • Full Member
  • ***
  • Posts: 180
Re: Single / Double / Float speed on x86_64
« Reply #16 on: December 12, 2025, 06:20:23 pm »
this was only a silly benchmark, the main reason for doing a sum is so that the compiler hopefully won't eliminate the loop and as aside it gives a hint on accuracy

BrunoK

  • Hero Member
  • *****
  • Posts: 762
  • Retired programmer
Re: Single / Double / Float speed on x86_64
« Reply #17 on: December 12, 2025, 06:35:07 pm »
this was only a silly benchmark, the main reason for doing a sum is so that the compiler hopefully won't eliminate the loop and as aside it gives a hint on accuracy
What was Sum of xsin in the range supposed to yield ?

The benchmark is not so silly because it illustrate the uncertain results of simulations, like parallel processing of COVID deaths models not matching single processor / multi threaded code results or non replicable simulations of some climate models (and others ...) not matching or not converging to a reasonable state.

 

srvaldez

  • Full Member
  • ***
  • Posts: 180
Re: Single / Double / Float speed on x86_64
« Reply #18 on: December 12, 2025, 06:41:13 pm »
What was Sum of xsin in the range supposed to yield ?
xsin is just an approximation of the sin function so in this case the sum should be zero or close

tetrastes

  • Hero Member
  • *****
  • Posts: 733
Re: Single / Double / Float speed on x86_64
« Reply #19 on: December 12, 2025, 09:10:39 pm »
Just in case, fpc cannot optimize Power(2, -3) to 0.125, as gcc does.

 

TinyPortal © 2005-2018