mirror of
https://github.com/lemire/fast_double_parser.git
synced 2025-04-03 20:04:57 +00:00
Update table_generation.py
This commit is contained in:
parent
6a47c2a5a1
commit
d52e3059bd
1 changed files with 10 additions and 8 deletions
|
@ -1,10 +1,4 @@
|
|||
def format(number):
|
||||
# move the most significant bit in position
|
||||
while(number < (1<<127)):
|
||||
number *= 2
|
||||
# then *truncate*
|
||||
while(number >= (1<<128)):
|
||||
number //= 2
|
||||
upper = number // (1<<64)
|
||||
lower = number % (1<<64)
|
||||
print(""+hex(upper)+","+hex(lower)+",")
|
||||
|
@ -14,16 +8,24 @@ for q in range(-342,0):
|
|||
z = 0
|
||||
while( (1<<z) < power5) :
|
||||
z += 1
|
||||
if( q >= -17 ):
|
||||
if(q >= -27):
|
||||
b = z + 127
|
||||
c = 2 ** b // power5 + 1
|
||||
assert c < (1<<128)
|
||||
format(c)
|
||||
else:
|
||||
b = 2 * z + 2 * 64
|
||||
c = 2 ** b // power5 + 1
|
||||
# truncate
|
||||
while(c >= (1<<128)):
|
||||
c //= 2
|
||||
format(c)
|
||||
|
||||
for q in range(0,308+1):
|
||||
power5 = 5 ** q
|
||||
# move the most significant bit in position
|
||||
while(power5 < (1<<127)):
|
||||
power5 *= 2
|
||||
# *truncate*
|
||||
while(power5 >= (1<<128)):
|
||||
power5 //= 2
|
||||
format(power5)
|
||||
|
|
Loading…
Add table
Reference in a new issue