Files
Odin/base/runtime
Simon Branch 8f4f92db8f Fix runtime quaternion division
The runtime implementations of quaternion division are incorrect when
calculating q/r with nonzero jmag(r) and either nonzero imag(q) or
kmag(q).  Notably, the inverse 1/r is still calculated correctly
because imag(1) = kmag(1) = 0.

The mistake can be verified by calculating (a/b)*b which will be very
different from both a and a * (1/b) * b.

The compile-time constant folding is correct, see exact_value.cpp
in function exact_binary_operator_value -> ExactValue_Quaternion ->
Token_Quo.

    quo256 :: proc(q, r: quaternion256) -> quaternion256 { return q/r }
    a: quaternion256 : 3 + 5i + 7j + 11k
    b: quaternion256 : 2 + 7i + 3j + 5k
    c: quaternion256 : a/b
    fmt.println("comp", abs((c*b) - a))
    fmt.println("run ", abs(quo256(a,b)*b - a))
    // both values should be very close to zero;
    // without fix, only the first is
2026-08-05 20:43:50 -07:00
..
2025-07-31 16:40:40 +02:00
2026-01-28 11:54:17 +00:00
2026-05-04 10:58:16 +01:00
2026-08-05 20:43:50 -07:00
2025-08-08 13:29:49 +01:00
2024-06-05 20:57:39 +02:00
2026-08-05 19:02:35 +02:00
2026-05-02 15:06:01 +01:00
2025-11-05 13:44:14 +00:00