Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add constructor like Complex{Float64} #81

Closed
hyrodium opened this issue Mar 31, 2022 · 2 comments
Closed

Add constructor like Complex{Float64} #81

hyrodium opened this issue Mar 31, 2022 · 2 comments

Comments

@hyrodium
Copy link
Collaborator

The following MethodError should be fixed.

julia> using Quaternions

julia> Quaternion{Float64}(1)
QuaternionF64(1.0, 0.0, 0.0, 0.0, true)

julia> Quaternion{Float64}(1,2,3,4)
ERROR: MethodError: no method matching QuaternionF64(::Int64, ::Int64, ::Int64, ::Int64)
Closest candidates are:
  Quaternion{T}(::Any, ::Any, ::Any, ::Any, ::Any) where T<:Real at ~/.julia/dev/Quaternions/src/Quaternion.jl:2
  Quaternion{T}(::Real) where T<:Real at ~/.julia/dev/Quaternions/src/Quaternion.jl:13
  (::Type{T})(::T) where T<:Number at ~/julia/julia-1.7.1/share/julia/base/boot.jl:770
Stacktrace:
 [1] top-level scope
   @ REPL[3]:1

julia> Complex{Float64}(1)
1.0 + 0.0im

julia> Complex{Float64}(1,2)
1.0 + 2.0im
@sethaxen
Copy link
Collaborator

This should be handled implicitly when #75 is finished.

@hyrodium
Copy link
Collaborator Author

hyrodium commented Dec 1, 2022

This issue was already solved, maybe by #108:

julia> using Quaternions

julia> Quaternion{Float64}(1)
QuaternionF64(1.0, 0.0, 0.0, 0.0)

julia> Quaternion{Float64}(1,2,3,4)
QuaternionF64(1.0, 2.0, 3.0, 4.0)

@hyrodium hyrodium closed this as completed Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants