This commit is contained in:
沈瑗杰 2020-12-26 00:08:52 +08:00
parent e5ca9a5687
commit e0aac26713
4 changed files with 23 additions and 13 deletions

View File

@ -8,16 +8,18 @@ file name stand for : Physics calculation
import libs
import math
from libs.tools import F_Mi, F_Mu, F_A, F_D
def S_C_float_check(SC): # stand for Scientific notation's float check
"""
formats:
SC list format:docs.basic_config.json:basic_number"""
while SC[0] >= 10:
SC[0] /= 10
SC[0] = F_D(SC[0], 10)
SC[1] += 1
while SC[0] < 1:
SC[0] *= 10
SC[0] = F_Mu(SC[0], 10)
SC[1] -= 1
@ -25,7 +27,7 @@ def S_N_M(A, B): # stand for Scientific notation multiple
"""
formats:
A & B list format:docs.basic_config.json:basic_number"""
C = [A[0] * B[0], int(A[1] + B[1])]
C = [F_Mu(A[0], B[0]), F_A(A[1], B[1])]
S_C_float_check(C)
Unit1, Unit2 = A[2] + B[2], A[3] + B[3]
if Unit1 == None:
@ -39,7 +41,7 @@ def S_N_D(A, B): # stand for Scientific notation divided
"""
formats:
A & B list format:docs.basic_config.json:basic_number"""
C = [float(A[0] / B[0]), int(A[1] - B[1])]
C = [F_D(A[0], B[0]), F_Mi(A[1], B[1])]
S_C_float_check(C)
Unit1, Unit2 = A[2] + B[3], A[3] + B[2]
if Unit1 == None:

View File

@ -6,7 +6,7 @@ mail: 3695888@qq.com
import libs.Game_threads
# import in this forder
import libs.S_D
import libs.P_C
import libs.main
import libs.tools
import libs.loads

View File

@ -35,16 +35,24 @@ def D_C(listA, listB): # stand for Duplicate check
def F_Mu(A, B): # stand for float multiple
pass
a = decimal.Decimal(str(A))
b = decimal.Decimal(str(B))
return float(a * b)
def F_D(A, B): # stand for float divided
pass
a = decimal.Decimal(str(A))
b = decimal.Decimal(str(B))
return float(a / b)
def F_P(A, B): # stand for float plus
pass
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
pass
a = decimal.Decimal(str(A))
b = decimal.Decimal(str(B))
return float(a - b)

View File

@ -12,9 +12,9 @@ B = [2.45, -7, ["N", "kg"], ["m", "s"]]
print("A = " , A)
print("B = " , B)
C = libs.S_D.S_N_M(A, B)
D = libs.S_D.S_N_D(A, B)
E = libs.S_D.S_N_D(C, B)
C = libs.P_C.S_N_M(A, B)
D = libs.P_C.S_N_D(A, B)
E = libs.P_C.S_N_D(C, B)
print("A × B = " , C)
print("A ÷ B = " , D)