online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
import timeit import math # Each function checks for all numbers between 1 and a million if they are a power of 2 def log(): for n in range(1, 1000000): math.log(n, 2).is_integer() def frexp(): for n in range(1, 1000000): abs(math.frexp(n)[0]) == 0.5 def log2(): for n in range(1, 1000000): math.log2(n).is_integer() def binary(): for n in range(1, 1000000): (n & (n - 1) == 0) and n != 0 for func in (log, frexp, log2, binary): num = 5 # 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