Category talk:Wren-fmt: Difference between revisions
→Source code: Changes to complex number formatting.
(→Source code: Some minor improvements.) |
(→Source code: Changes to complex number formatting.) |
||
Line 481:
}
// Applies the 'fm' and 'f'
// complex number 'n' before joining them together in the form x ± yi.
static z(w, n, p) {
if (n is Num) return f(w, n, p)
if (n.type.toString != "Complex") Fiber.abort("Argument must be a complex or real number.")
var real =
var sign = (n.imag >= 0) ? " + " : " - "
var imag = f(w, n.imag.abs, p)
if (w < 0) imag = imag.trimEnd(" ")
return real + sign + imag + "i"
}
|