AlgebraicNumbers.jl icon indicating copy to clipboard operation
AlgebraicNumbers.jl copied to clipboard

conversion and promotion to floats

Open putianyi889 opened this issue 11 months ago • 3 comments

putianyi889 avatar Mar 26 '24 11:03 putianyi889

Coverage Status

coverage: 91.463% (-1.5%) from 93.004% when pulling c0ba93eee4b636c11d377a6ac6be753bffd27222 on putianyi889:patch-1 into 26f27c3de10d2a2a5f7270420f1b776dccb9de8c on anj1:master.

coveralls avatar Mar 26 '24 13:03 coveralls

Hi, thanks for your interest in this project. I'm not convinced that we want to have this promote_rule. Could you provide your rationale for choosing T over AlgebraicNumber as promoted type? Also I would probably sort that under the existing "promotions" heading.

Less importantly, I wonder if we should provide a nicer error message for the case where one tries to cast a genuinely complex-valued AlgebraicNumber to float. But maybe the InexactError is already descriptive enough.

fkastner avatar Mar 26 '24 13:03 fkastner

Could you provide your rationale for choosing T over AlgebraicNumber as promoted type?

I think it's the same as irrationals. https://github.com/JuliaLang/julia/blob/64de065a183ac70bb049f7f9e30d790f8845dd2b/base/irrationals.jl#L44-L52

Also I would probably sort that under the existing "promotions" heading.

The top comments of the file says it's meant to only support integers, but I could edit that anyway.

to cast a genuinely complex-valued AlgebraicNumber to float

I forgot algebraic numbers are complex. I'll add complex promotions as well.

putianyi889 avatar Mar 26 '24 14:03 putianyi889