Non-decimal radices/Input: Difference between revisions

m
No edit summary
m (→‎{{header|Wren}}: Minor tidy)
(One intermediate revision by one other user not shown)
Line 1,461:
-987654321
</pre>
 
=={{header|RPL}}==
Floating-point numbers can only be entered in decimal format:
3.14
Unsigned integers, which must begin with <code>#</code>, can be expressed in binary, octal, decimal or hexadecimal. A final lowercase letter defines the base.
#100111010b
#472o
#314d
#13Ah
 
=={{header|Ruby}}==
Line 1,657 ⟶ 1,666:
=={{header|Wren}}==
{{libheader|Wren-fmt}}
<syntaxhighlight lang="ecmascriptwren">import "./fmt" for Conv, Fmt
 
var tests = [ ["0b1110", 2], ["112", 3], ["0o16", 8], ["14", 10], ["0xe", 16], ["e", 19] ]
for (test in tests) {
SystemFmt.print("%(Fmt.$6s in base $-2d = $s(6", test[0])) in base %(Fmt.d(-2, test[1])), = %(Conv.atoi(test[0], test[1]))")
} </syntaxhighlight>
 
9,487

edits