Thanks for that. I should have added I'm using Delphi 7 so a 32-bit compiler. I assume with newer 64-bit compilers an integer is 64 bits by default?
From: [email protected] [mailto:[email protected]] On Behalf Of Pieter De Wit Sent: Sunday, 17 August 2014 11:04 a.m. To: [email protected] Subject: Re: [DUG] Int64 or floating point faster? On 16/08/2014 15:30, Ross Levis wrote: Would I be correct that int64 multiplications would be faster than floating point in Delphi? My app needs to do several million. _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: [email protected] Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to [email protected] with Subject: unsubscribe Hi, Back in the good old days, a float was "int32.int32" - I am not sure what they have done with it since 64bit CPU's came about, but the theory should stay the same: int64=64bit=1 clock cycle to move. The "mul" command is normally 2 or 3 cycles, so worst case, your int64*int64 will be 6 cycle at worst (2 mov's, 3 for mul and 1 mov for the answer - moving it to your variable) By comparison, using float *via the x64* will result in at least 18 cycles - too early on a Sunday to work it out 100% :) The tricky part, is the floating point CPU in your machine faster than the x64 - or more optimized for doing this? I don't know but I am willing to bet that it is not - floating point math has always been slower for me. HTH, Pieter
_______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: [email protected] Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to [email protected] with Subject: unsubscribe
