mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-03 00:18:20 +00:00
One more way to transform a float to single (commented out)
This commit is contained in:
parent
94ea0a1140
commit
4172f02439
1 changed files with 4 additions and 0 deletions
|
@ -134,6 +134,10 @@ def F32(f, f32=True):
|
||||||
#from struct import pack, unpack
|
#from struct import pack, unpack
|
||||||
#return unpack('f', pack('f', f))[0]
|
#return unpack('f', pack('f', f))[0]
|
||||||
|
|
||||||
|
# Using numpy:
|
||||||
|
#import numpy
|
||||||
|
#return float(numpy.float32(f))
|
||||||
|
|
||||||
# Using ctypes:
|
# Using ctypes:
|
||||||
#from ctypes import c_float
|
#from ctypes import c_float
|
||||||
return c_float(f).value
|
return c_float(f).value
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue