2017-03-08 23:11:05 +00:00
|
|
|
try:
|
2019-10-22 07:33:23 +01:00
|
|
|
from uarray import array
|
2017-03-08 23:11:05 +00:00
|
|
|
except ImportError:
|
2019-10-22 07:33:23 +01:00
|
|
|
try:
|
|
|
|
from array import array
|
|
|
|
except ImportError:
|
|
|
|
print("SKIP")
|
|
|
|
raise SystemExit
|
2014-11-21 18:16:25 +00:00
|
|
|
|
2020-03-23 02:26:08 +00:00
|
|
|
|
2014-11-21 18:16:25 +00:00
|
|
|
def test(a):
|
|
|
|
print(a)
|
|
|
|
a.append(1.2)
|
|
|
|
print(len(a), "%.3f" % a[0])
|
|
|
|
a.append(1)
|
|
|
|
a.append(False)
|
|
|
|
print(len(a), "%.3f %.3f" % (a[1], a[2]))
|
|
|
|
a[-1] = 3.45
|
|
|
|
print("%.3f" % a[-1])
|
2020-03-23 02:26:08 +00:00
|
|
|
|
2014-11-21 18:16:25 +00:00
|
|
|
|
|
|
|
test(array("f"))
|
|
|
|
test(array("d"))
|
2015-08-31 23:43:31 +01:00
|
|
|
|
2021-05-20 01:02:57 +01:00
|
|
|
print("{:.4f}".format(array("f", bytes(array("I", [0x3DCCCCCC])))[0]))
|