You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(square (square (square 1000))) calculates incorrectly. Value returned is '5726162197579952128' while the correct answer is '1008028056070056028008001'. Probably due to the implementation of integers using c's 'long' type and LONG_MAX is '9223372036854775807' (32-bit). Switching to type 'long long' (64-bit) would correct the problem for this example. Switching to GMP or some other library to handle arbitrary precision arithmetic would be perhaps better. For space efficiency, might be great to sense overflows and automatically switch base types
The text was updated successfully, but these errors were encountered:
(square (square (square 1000))) calculates incorrectly. Value returned is '5726162197579952128' while the correct answer is '1008028056070056028008001'. Probably due to the implementation of integers using c's 'long' type and LONG_MAX is '9223372036854775807' (32-bit). Switching to type 'long long' (64-bit) would correct the problem for this example. Switching to GMP or some other library to handle arbitrary precision arithmetic would be perhaps better. For space efficiency, might be great to sense overflows and automatically switch base types
The text was updated successfully, but these errors were encountered: