spppppeed teeeeest!
This commit is contained in:
parent
8d8d28221d
commit
f7d2a06371
@ -7,11 +7,7 @@ file name stand for : Physics calculation
|
||||
|
||||
import libs
|
||||
import math
|
||||
|
||||
F_A = libs.tools.F_A()
|
||||
F_D = libs.tools.F_D()
|
||||
F_Mi = libs.tools.F_Mi()
|
||||
F_Mu = libs.tools.F_mu()
|
||||
from decimal import Decimal as D
|
||||
|
||||
|
||||
def S_C_float_check(SC): # stand for Scientific notation's float check
|
||||
|
@ -33,26 +33,3 @@ def D_C(listA, listB): # stand for Duplicate check
|
||||
listB.sort()
|
||||
return
|
||||
|
||||
|
||||
def F_Mu(A, B): # stand for float multiple
|
||||
a = decimal.Decimal(str(A))
|
||||
b = decimal.Decimal(str(B))
|
||||
return float(a * b)
|
||||
|
||||
|
||||
def F_D(A, B): # stand for float divided
|
||||
a = decimal.Decimal(str(A))
|
||||
b = decimal.Decimal(str(B))
|
||||
return float(a / b)
|
||||
|
||||
|
||||
def F_A(A, B): # stand for float plus
|
||||
a = decimal.Decimal(str(A))
|
||||
b = decimal.Decimal(str(B))
|
||||
return float(a + b)
|
||||
|
||||
|
||||
def F_Mi(A, B): # stand for float minus
|
||||
a = decimal.Decimal(str(A))
|
||||
b = decimal.Decimal(str(B))
|
||||
return float(a - b)
|
||||
|
42
test_speed.py
Normal file
42
test_speed.py
Normal file
@ -0,0 +1,42 @@
|
||||
import time
|
||||
|
||||
from decimal import Decimal as D
|
||||
|
||||
|
||||
times = 1000000
|
||||
|
||||
a = 1
|
||||
b = 2
|
||||
|
||||
c = 0.1
|
||||
d = 2.1
|
||||
|
||||
a_start_time = time.time()
|
||||
for x in range(0, times, 1):
|
||||
Da = D(str(a))
|
||||
Db = D(str(b))
|
||||
Dc = Da * Db
|
||||
a_stop_time = time.time()
|
||||
|
||||
b_start_time = time.time()
|
||||
Da = D(str(a))
|
||||
Db = D(str(b))
|
||||
for x in range(0, times, 1):
|
||||
Dc = Da * Db
|
||||
b_stop_time = time.time()
|
||||
|
||||
c_start_time = time.time()
|
||||
for x in range(0, times, 1):
|
||||
Tc = a * b
|
||||
c_stop_time = time.time()
|
||||
|
||||
def test(times, a, b):
|
||||
t = times
|
||||
s = time.time()
|
||||
while t:
|
||||
|
||||
t -= 1
|
||||
e = time.time()
|
||||
return e - s
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user