Jump to content

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' formatformats respectively to each component, x and y, of a complex number 'n'
// 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 = ffm(w, n.real, p)
var sign = (n.imag >= 0) ? " + " : " - "
var imag = f(w, n.imag.abs, p)
if (w < 0) imag = imag.trimEnd(" ")
return real + sign + imag + "i"
}
9,485

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.