davidrmiller / biosim4

Biological evolution simulator
Other
3.1k stars 435 forks source link

Exception on run. #78

Closed Ccode-lang closed 2 years ago

Ccode-lang commented 2 years ago
pi@raspberrypi:~/biosim4 $ ./bin/Debug/biosim4 biosim4.ini
Floating point exception

It doesn't even tell any other info.

Ccode-lang commented 2 years ago

found a warning in build that might be causing it.

src/basicTypes.cpp:154:30: warning: left shift count >= width of type [-Wshift-count-overflow]
  154 |     len = (len + temp) / (1L << 32); // Divide to make sure we get an arithmetic shift
      |                           ~~~^~~~~
src/basicTypes.cpp:154:24: warning: division by zero [-Wdiv-by-zero]
  154 |     len = (len + temp) / (1L << 32); // Divide to make sure we get an arithmetic shift
      |           ~~~~~~~~~~~~~^~~~~~~~~~~~
davidrmiller commented 2 years ago

Thanks for reporting this. Issue #74 mentioned a similar error in the same source file where some 1L constants needed to be changed to 1LL when they appear in a 64-bit expression on a raspi. It looks like we didn't catch them all. We probably need to change the 1L to 1LL in lines 153 and 154 as well. I'll test that change and update the main branch.

Edit: tested and main branch updated.

Ccode-lang commented 2 years ago

Thanks, I'll test in a bit.

Ccode-lang commented 2 years ago

Works, Thanks!