We have encountered a segmentation fault (SEGFPE) when performing the modulus operation on zero with negative signed numbers greater than 128 bits using Boost Multiprecision. This issue does not occur with 128-bit numbers.
Steps to Reproduce:
Define int128_t and int129_t using Boost Multiprecision with signed_magnitude and checked types.
Perform modulus operation with zero on a negative number.
Trying int128_t...
Exception: Division by zero.
int128_t catched...
Trying int129_t...
Exception: Integer Division by zero.
int129_t catched...
It seems that the templates picked are different for the modulus and division operations depending on the bit size of the number. Please investigate this discrepancy and provide a fix.
Description:
We have encountered a segmentation fault (SEGFPE) when performing the modulus operation on zero with negative signed numbers greater than 128 bits using Boost Multiprecision. This issue does not occur with 128-bit numbers.
Steps to Reproduce:
Sample Code:
Observed Behavior:
Expected Behavior:
The modulus operation should throw an exception for both int128_t and int129_t.
Additional Information:
Expected Output
It seems that the templates picked are different for the modulus and division operations depending on the bit size of the number. Please investigate this discrepancy and provide a fix.