You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.0 KiB
Python

from decimal import Decimal, getcontext
def get_material_cost(scope, total_equipment):
# Set precision to 28 digits (maximum precision for Decimal)
getcontext().prec = 28
if not total_equipment: # Guard against division by zero
return float(0)
if scope == 'B':
result = Decimal('365539731101') / Decimal(str(total_equipment))
return float(result)
else:
result = Decimal('8565468127') / Decimal(str(total_equipment))
return float(result)
return float(0)
def get_service_cost(scope, total_equipment):
# Set precision to 28 digits (maximum precision for Decimal)
getcontext().prec = 28
if not total_equipment: # Guard against division by zero
return float(0)
if scope == 'B':
result = Decimal('36405830225') / Decimal(str(total_equipment))
return float(result)
else:
result = Decimal('36000000000') / Decimal(str(total_equipment))
return float(result)
return float(0)