mirror of
https://github.com/licsber/micropython.git
synced 2024-09-20 09:00:23 +08:00
16 lines
247 B
Python
16 lines
247 B
Python
|
# test that math functions support user classes with __float__
|
||
|
|
||
|
try:
|
||
|
import math
|
||
|
except ImportError:
|
||
|
print("SKIP")
|
||
|
raise SystemExit
|
||
|
|
||
|
|
||
|
class TestFloat:
|
||
|
def __float__(self):
|
||
|
return 1.0
|
||
|
|
||
|
|
||
|
print("%.5g" % math.exp(TestFloat()))
|