Problem:
A BadPeriodError is raised (or the corresponding tuple returned) when the period is 0, but not when the period is negative or even a floating-point number.
When porting to C, this could lead to unwanted behavior when typecasting floats to integers. However, I'm not sure how the GMP library handles this case.
It should be resolved nevertheless; from a user's perspective this is unwanted behavior.
Solution:
Periods should come in the form of a non-zero unsigned integer. Anything else should raise a BadPeriodError, or return {:error, :bad_period}.
Problem:
A
BadPeriodErroris raised (or the corresponding tuple returned) when the period is 0, but not when the period is negative or even a floating-point number.When porting to C, this could lead to unwanted behavior when typecasting floats to integers. However, I'm not sure how the GMP library handles this case.
It should be resolved nevertheless; from a user's perspective this is unwanted behavior.
Solution:
Periods should come in the form of a non-zero unsigned integer. Anything else should raise a
BadPeriodError, or return{:error, :bad_period}.