Adding minor changes
This commit is contained in:
parent
2dfcb8404d
commit
9767e0039d
1 changed files with 12 additions and 9 deletions
|
@ -43,13 +43,13 @@ def overlap(arg1: str, arg2: str) -> str:
|
||||||
arg2_decimal_part = arg2_decimal_part + '0'*(max_decimal_part_size-len(arg2_decimal_part))
|
arg2_decimal_part = arg2_decimal_part + '0'*(max_decimal_part_size-len(arg2_decimal_part))
|
||||||
#---------
|
#---------
|
||||||
if not(arg1_is_negative) and arg2_is_negative: #arg1 positive - arg2 negative
|
if not(arg1_is_negative) and arg2_is_negative: #arg1 positive - arg2 negative
|
||||||
overlap_result += "1"
|
overlap_result += '1'
|
||||||
elif not(arg1_is_negative) and not(arg2_is_negative): #arg1 positive - arg2 positive
|
elif not(arg1_is_negative) and not(arg2_is_negative): #arg1 positive - arg2 positive
|
||||||
overlap_result += "2"
|
overlap_result += '2'
|
||||||
elif arg1_is_negative and not(arg2_is_negative): #arg1 negative - arg2 positive
|
elif arg1_is_negative and not(arg2_is_negative): #arg1 negative - arg2 positive
|
||||||
overlap_result += "3"
|
overlap_result += '3'
|
||||||
elif arg1_is_negative and arg2_is_negative: #arg1 negative - arg2 negative
|
elif arg1_is_negative and arg2_is_negative: #arg1 negative - arg2 negative
|
||||||
overlap_result += "4"
|
overlap_result += '4'
|
||||||
#---------
|
#---------
|
||||||
for index in range(max_integer_part_size):
|
for index in range(max_integer_part_size):
|
||||||
overlap_result += arg1_integer_part[index]
|
overlap_result += arg1_integer_part[index]
|
||||||
|
@ -72,13 +72,13 @@ def unoverlap(arg: str) -> Sequence[str]:
|
||||||
else: arg_is_full_integer = False
|
else: arg_is_full_integer = False
|
||||||
except:
|
except:
|
||||||
pass#nothing to do
|
pass#nothing to do
|
||||||
if arg_integer_part[0]=="1": #arg1 must be positive - arg2 must be negative
|
if arg_integer_part[0]=='1': #arg1 must be positive - arg2 must be negative
|
||||||
arg2 += '-'
|
arg2 += '-'
|
||||||
elif arg_integer_part[0]=="2": #arg1 must be positive - arg2 must be positive
|
elif arg_integer_part[0]=='2': #arg1 must be positive - arg2 must be positive
|
||||||
pass
|
pass
|
||||||
elif arg_integer_part[0]=="3": #arg1 must be negative - arg2 must be positive
|
elif arg_integer_part[0]=='3': #arg1 must be negative - arg2 must be positive
|
||||||
arg1 += '-'
|
arg1 += '-'
|
||||||
elif arg_integer_part[0]=="4": #arg1 must be negative - arg2 must be negative
|
elif arg_integer_part[0]=='4': #arg1 must be negative - arg2 must be negative
|
||||||
arg1 += '-'
|
arg1 += '-'
|
||||||
arg2 += '-'
|
arg2 += '-'
|
||||||
arg_integer_part = arg_integer_part[1:] #ignoring signs' digit now as it's already used
|
arg_integer_part = arg_integer_part[1:] #ignoring signs' digit now as it's already used
|
||||||
|
@ -242,7 +242,7 @@ def sb_substract(arg1: str, arg2: str) -> str:
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def sb_multiply(arg1: str, arg2: str) -> bool:
|
def sb_multiply(arg1: str, arg2: str) -> str:
|
||||||
# transform arg1 to string if not already in string and test if it's a full integer (without decimal part or decimal part equals zero)
|
# transform arg1 to string if not already in string and test if it's a full integer (without decimal part or decimal part equals zero)
|
||||||
arg1_as_string = str(arg1)
|
arg1_as_string = str(arg1)
|
||||||
arg1_integer_part = arg1_as_string
|
arg1_integer_part = arg1_as_string
|
||||||
|
@ -314,6 +314,9 @@ def good_format(result: str) -> str:
|
||||||
while '.' in result and result.endswith('0'): result = result[:-1]
|
while '.' in result and result.endswith('0'): result = result[:-1]
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def sb_division(arg1: str, arg2: str) -> str:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
if __name__=='__main__':
|
if __name__=='__main__':
|
||||||
#print("add", sb_addition("2222222222222222222222222222222222222222.55", "2.55") )
|
#print("add", sb_addition("2222222222222222222222222222222222222222.55", "2.55") )
|
||||||
|
|
Loading…
Reference in a new issue