rust-num / num-complex

Complex numbers for Rust
Apache License 2.0
232 stars 50 forks source link

Proposal: Rename Complex{32,64} to ComplexF{32,64} #77

Closed eduardosm closed 6 months ago

eduardosm commented 4 years ago

This proposal would involves breaking changes and it is also a bit of personal opinion, so feel free to close it.

The names Complex32 or Complex64 may be confusing for some users, because it might mean "a complex of 32/64 bits in total" or "a complex formed by two 32/64 bit floats".

For example, numpy has complex64 (2 x 32) and complex128 (2 x 64). Pre-1.0 Julia also had Complex64 and Complex128.

In Julia 1.0 they decided to take the approach of using ComplexF32 and ComplexF64, which, in my opinion, it specifies more clearly "a complex formed by two 32/64 bit floats". This naming also has the advantage of remarking that they use float as number format.

cuviper commented 4 years ago

Do you have any links discussing this change for Julia?

The master branch could currently accept breaking changes for the upcoming 0.3. However, this request doesn't have to be a breaking change if we also keep the existing names, just #[deprecated]. Type aliases are all interchangeable anyway, so any/all names we use are really just Complex<f64> and Complex<f32> to the compiler in the end.

IMO these names have limited benefit already -- when you're writing Complex64, and moreso ComplexF64, it's a small step to just write the fully explicit Complex<f64>.

See also #21 that wants really short names like c64 or C64. I guess that's still open to your question whether that indicates total size or component size though.

eduardosm commented 4 years ago

Do you have any links discussing this change for Julia?

https://github.com/JuliaLang/julia/pull/24647

I think the PR originally only removed/deprecated the old aliases (https://github.com/JuliaLang/julia/pull/24647#issuecomment-348320505), and then it was modified to add the ComplexF* aliases.

cuviper commented 6 months ago

Given the large amount of existing uses, I think even deprecation would be too much churn. https://github.com/search?q=lang%3Arust+%28Complex32+OR+Complex64%29&type=code