Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,13 +0,0 @@
|
|||
function toBinary(integer i)
|
||||
sequence s
|
||||
s = {}
|
||||
while i do
|
||||
s = prepend(s, '0'+and_bits(i,1))
|
||||
i = floor(i/2)
|
||||
end while
|
||||
return s
|
||||
end function
|
||||
|
||||
puts(1, toBinary(5) & '\n')
|
||||
puts(1, toBinary(50) & '\n')
|
||||
puts(1, toBinary(9000) & '\n')
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
include std/math.e
|
||||
include std/convert.e
|
||||
|
||||
function Bin(integer n, sequence s = "")
|
||||
if n > 0 then
|
||||
return Bin(floor(n/2),(mod(n,2) + #30) & s)
|
||||
end if
|
||||
if length(s) = 0 then
|
||||
return to_integer("0")
|
||||
end if
|
||||
return to_integer(s)
|
||||
end function
|
||||
|
||||
printf(1, "%d\n", Bin(5))
|
||||
printf(1, "%d\n", Bin(50))
|
||||
printf(1, "%d\n", Bin(9000))
|
||||
Loading…
Add table
Add a link
Reference in a new issue