The format types x (hex), X (hex in capitals), o (octal) and b (binary) show an int in
that base: "{n:x}", "{n:08b}". A negative int shows its 64-bit two's complement. They
don't apply to other types.
Wrong#
fn show(x: float): str = "{x:x}"Fixed#
fn show(x: float): str = "{int(x):x}"Common causes#
- A
floatorcharformatted as hex: convert withint(x)(a char's code point isint(c)). - A float's bits:
"{x.bits():016x}".