Quaternion type: Difference between revisions

Content added Content deleted
(→‎{{header|Julia}}: more cleanup)
Line 2,777: Line 2,777:


=={{header|Julia}}==
=={{header|Julia}}==
This is from the [https://github.com/JuliaLang/julia/blob/master/examples/quaternion.jl quaternion example file] included with Julia 0.2, which implements a quaternion type complete with arithmetic, type conversions and promotion rules, and pretty-printing:
This is from the [https://github.com/JuliaLang/julia/blob/master/examples/quaternion.jl quaternion example file] included with Julia 0.2, which implements a quaternion type complete with arithmetic, type conversions / promotion rules, polymorphism over arbitrary real numeric types, and pretty-printing:
<lang julia>import Base: convert, promote_rule, show, real, imag, conj, abs, abs2, inv, +, -, /, *
<lang julia>import Base: convert, promote_rule, show, real, imag, conj, abs, abs2, inv, +, -, /, *