Lucifers,
When reviewing the Clownfish Num classes, I made the following observations:
- FloatNum_Compare_To isn't correct for large IntNums.
- IntNum_Compare_To and Int64_Equals aren't correct for large
FloatNums.
- Num_Equals doesn't handle the corner case of IntNums near
INT64_MAX correctly.
- Converting FloatNums to IntNums doesn't check for overflow.
This is fixed in my `num_compare` branch:
https://github.com/nwellnhof/lucy-clownfish/commits/num_compare
Then there's an asymmetry when comparing BoolNums.
BoolNum_Equals(CFISH_FALSE, Int32_new(0)) == false
Int32_Equals(Int32_new(0), CFISH_FALSE) == true
My original fix was to remove the specialization of BoolNum_Equals. But
thinking more about it, it might be better to make BoolNum not inherit from
Num at all. This would mean that a Boolean never equals a Num and that
Compare_To throws when comparing Booleans and Nums.
Nick