Non-decimal radices/Input: Difference between revisions

m
No edit summary
 
(3 intermediate revisions by 3 users not shown)
Line 362:
? __makeInt("200", 10)
# value: 200</syntaxhighlight>
 
=={{header|EasyLang}}==
<syntaxhighlight>
repeat
s$ = input
until s$ = ""
a = number s$
print a
.
#
input_data
1234
0xa0
</syntaxhighlight>
{{out}}
<pre>
1234
160
</pre>
 
=={{header|Elixir}}==
Line 1,461 ⟶ 1,480:
-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,685:
=={{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>
 
2,080

edits