dimforge / alga

Abstract algebra for Rust.
194 stars 39 forks source link

Consider softening the demands on ComplexField #83

Open NeverGivinUp opened 5 years ago

NeverGivinUp commented 5 years ago

If I understand correctly every RealField must implement ComplexField (with the imaginary part set to zero) and every ComplexField must be a super-set of f64, that is, it must be able to represent all values of f64 logically (disregarding machine specific limitations). Decorum's N64 and R64 types logically cannot be NotANumber or Infinity. They thus are not logical super-sets of f64.

For my calculations results of NaN or Infinity are logical errors. I put finite numbers in and expect my calculations to result in finite numbers. I'd thus like to use Deorum's numbers.

My attempt to implement the traits, required for ComplexField, failed at the above requirement. Would it be possible to remove the requirement or replace it by a softer requirement, like Decorum's Real or Real+Encoding?

zakarumych commented 5 years ago

This also would make RealField implementable by fixed-precision numeric types.