bit.print_dec_intΒΆ
prints x[:n] as a signed decimal number (without leading zeros).
The number 28/93 is the ratio of the number of decimal digits and the number of binary digits.
Itβs bigger than log(2)/log(10) by 0.015%, which is just enough.
SignatureΒΆ
def print_dec_int n, x @ do_print, end, neg { ... }
Defined in bit/output.fj β lines 229β242 (view on GitHub).
ComplexityΒΆ
Time:
n^2(2@+4) // actually: nd(7@+12) (for d number of decimal digits)Space:
n(16@+23)
See the complexity glossary for what @, w, dw, dbit, n mean.
SourceΒΆ
Click to view the macro body
def print_dec_int n, x @ do_print, end, neg {
.zero neg
.if0 x+(n-1)*dw, do_print
.not neg
stl.output '-'
.neg n, x
do_print:
.print_dec_uint n, x
.if0 neg, end
.neg n, x
;end
neg: .bit
end:
}
Depends onΒΆ
β Previous: bit.print_dec_uint.print_char