(res, round_to=2)
| 53 | |
| 54 | # normalize the result to 2 decimal places and remove trailing zeros |
| 55 | def 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 |
| 71 | def add_(args): |