MCPcopy
hub / github.com/microsoft/JARVIS / normalize

Function normalize

easytool/data_funcqa/funchub/math.py:55–68  ·  view source on GitHub ↗
(res, round_to=2)

Source from the content-addressed store, hash-verified

53
54# normalize the result to 2 decimal places and remove trailing zeros
55def normalize(res, round_to=2):
56 # we round the result to 2 decimal places
57 res = custom_round(res, round_to)
58 res = str(res)
59 if "." in res:
60 while res[-1] == "0":
61 res = res[:-1]
62 res = res.strip(".")
63
64 # scientific notation
65 if "e" in res:
66 res = scito_decimal(res)
67
68 return res
69
70# 1. add
71def add_(args):

Callers 13

add_Function · 0.85
subtract_Function · 0.85
multiply_Function · 0.85
divide_Function · 0.85
power_Function · 0.85
sqrt_Function · 0.85
log_Function · 0.85
ln_Function · 0.85
choose_Function · 0.85
permutate_Function · 0.85
gcd_Function · 0.85
lcm_Function · 0.85

Calls 2

custom_roundFunction · 0.85
scito_decimalFunction · 0.85

Tested by

no test coverage detected