online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
import timeit import math N = 1000000 # Each function checks for all numbers between 0 and a million if they are a power of 2 def log(): for n in range(1, N): math.log(n, 2).is_integer() def frexp(): for n in range(1,N): abs(math.frexp(n)[0]) == 0.5 def log2(): for n in range(1,N): math.log2(n).is_integer() def binary(): for n in range(1,N): (n & (n - 1) == 0) and n != 0 def count_1(): for n in range(1,N): bin(num).count("1") == 1 def check_1(): for n in range(1,N): '1' not in bin(abs(n))[3:] def check_0(): for n in range(2,N): int(bin(abs(n))[3:]) == 0 def Ev(): def ev(x): if x==2: return True elif x%2: return False return ev(x//2) for n in range(1,N): ev(n) for func in (val for key, val in dict(vars()).items() if callable(val)): num = 10 # taking the average of `num` runs for each function time = timeit.timeit(func, number=num)/num print("{}: {:f}".format(func.__name__, time))

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue