Author Topic: exe performance of some C/C++ compilers  (Read 2133 times)

airr

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
Re: exe performance of some C/C++ compilers
« Reply #15 on: August 30, 2024, 09:01:57 AM »
At work, so I haven't tried compiling this yet, but what jumps out immediately is "DIM AS".

MBC doesn't support that syntax, it is based on an older version of BCX.

AIR.

airr

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
Re: exe performance of some C/C++ compilers
« Reply #16 on: August 30, 2024, 09:17:57 AM »
Is this the expected output?

riveraa@vdi:~/src$ ./powser2f
1
-0.5
0.166666666666667
-0.0416666666666668
0.0083333333333333
-0.00138888888888894
0.000198412698412254
-2.48015873020035E-05
2.75573192398681E-06
-2.75573195152035E-07

Press any key to continue . . .

AIR.

jbk

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
Re: exe performance of some C/C++ compilers
« Reply #17 on: August 30, 2024, 09:46:37 AM »
yes, although there's a small variance if compiled on Windows
I am normally on Windows but sometimes I boot into Ubuntu from an external HD, right now I am on Windows
the result on Windows compiled using
MinGW64 is
 1
-0.5
 0.166666666666667
-0.0416666666666668
 0.0083333333333333
-0.00138888888888905
 0.000198412698412587
-2.48015873021146E-05
 2.75573192265455E-06
-2.75573192154432E-07

<edit> the last number displayed is a little more accurate on Windows than what you posted, the actual value should be -1/3628800
so it might be that some calculation is not performed in double

« Last Edit: August 30, 2024, 10:45:40 AM by jbk »

airr

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
Re: exe performance of some C/C++ compilers
« Reply #18 on: August 30, 2024, 11:00:53 AM »
Okay, well at least MBC is translating without errors once "DIM AS" is changed to regular "DIM".

AIR.

airr

  • Sr. Member
  • ****
  • Posts: 265
    • View Profile
Re: exe performance of some C/C++ compilers
« Reply #19 on: August 30, 2024, 11:17:48 AM »
yes, although there's a small variance if compiled on Windows
I am normally on Windows but sometimes I boot into Ubuntu from an external HD, right now I am on Windows
the result on Windows compiled using
MinGW64 is
 1
-0.5
 0.166666666666667
-0.0416666666666668
 0.0083333333333333
-0.00138888888888905
 0.000198412698412587
-2.48015873021146E-05
 2.75573192265455E-06
-2.75573192154432E-07

<edit> the last number displayed is a little more accurate on Windows than what you posted, the actual value should be -1/3628800
so it might be that some calculation is not performed in double

Changing DOUBLE to LDOUBLE (long double) produces the following using MBC/G++ on my Linux server:

1
-0.5
0.166666666666667
-0.0416666666666668
0.0083333333333333
-0.00138888888888905
0.000198412698412587
-2.48015873021146E-05
2.75573192265455E-06
-2.75573192154432E-07

So I would think it's a precision issue with the GNU Compiler in this case.

AIR.

jbk

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
Re: exe performance of some C/C++ compilers
« Reply #20 on: August 30, 2024, 11:24:23 AM »
thanks airr for looking into this issue :)
I can live without the convenience of DIM AS