Quaternion type: Difference between revisions
Content added Content deleted
Line 2,778: | Line 2,778: | ||
=={{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 and promotion rules, and pretty-printing: |
||
<lang julia>import Base: promote_rule, |
<lang julia>import Base: convert, promote_rule, show, real, imag, conj, abs, abs2, inv, +, -, /, * |
||
immutable Quaternion{T<:Real} <: Number |
immutable Quaternion{T<:Real} <: Number |