Recent

Author Topic: 64 bit on Mac  (Read 2180 times)

Ian

  • New member
  • *
  • Posts: 7
64 bit on Mac
« on: October 26, 2017, 02:37:25 am »
Hello,

I've got a console application that is successfully running on windows, Linux (Ubuntu), and mac (Darwin).  I'm getting identical results on windows and Linux, as well as 64 bit in Delphi, but the results are slightly different on the mac.  I'm wondering if the mac version is 32 bit, but don't know how to check this or change it.

I'll be very grateful for any suggestions.

Thanks, Ian

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: 64 bit on Mac
« Reply #1 on: October 26, 2017, 03:29:32 am »
I'm wondering if the mac version is 32 bit, but don't know how to check this or change it.

Use the file command at the console on your executable. That will tell you whether it's 32-bit or 64-bit.

To compile a 64-bit executable, use the ppcx64 compiler instead of the ppc386 compiler.

You don't say what the difference is, but it might not have anything to do with 32 vs 64 bit.


Ian

  • New member
  • *
  • Posts: 7
Re: 64 bit on Mac
« Reply #2 on: October 26, 2017, 05:45:08 am »
Thanks Phil - I'm sure that's it.

I can only see the ppc386 compiler, but I'll figure out how to install the ppcx64 compiler.

I'm pretty sure it is to do with the 32 vs 64 bit arithmetic.  It's a complex mathematical model that runs on a daily time-step for several years.  As I said, I found that there were differences when I compiled it as 32 or 64 bit on Delphi, but the results are virtually identical with 64 bit on both Delphi and Lazarus, with Lazarus compiled on both windows and Linux.  I think it is something to do with the way the type 'double' is defined, but I'm happy that the results are consistent.

I appreciate the help.

Ian

mischi

  • Full Member
  • ***
  • Posts: 124
Re: 64 bit on Mac
« Reply #3 on: October 26, 2017, 07:38:54 am »
1) Although there might be many others reasons for different results, the first i would check is the use of extended. As much as I know, extended is 80 bit on i386 and 64 bit on x86_64. You can check the size of a type with the function SizeOf.
2) If the results differ significantly, you should probably review your code regarding rounding errors or use numerical libraries, like blas, lapack, gmp and so on.