2 ms·
From https://github.com/niklas-heer/speed-comparison/blob/master/dagger-poc/scmeta.py https://github.com/niklas-heer/speed-comparison/blob/master/... // [I r
by gus_massa 11mo ago
From https://github.com/niklas-heer/speed-comparison/blob/master/dagger-poc/scmeta.py https://github.com/niklas-heer/speed-comparison/blob/master/...
// [I removed the error checking]
def pi_accuracy(value_str):
"""Calculate accuracy of computed pi value.
Returns the number of correct decimal places (higher is better).
"""
value = float(value_str)
# math.pi is available in MicroPython
accuracy = 1 - (value / math.pi)
return -math.log10(abs(accuracy))