I'm working with 3 sides of a triangle and trying to calculate its angles.
Sides are:
1.897188816229867142483767540106223394680554191282313497376163666145520171949117215017130626257969751E187390
2.581860838579567156635129752756628333180547211519304101349352896375658141271175354632905314191897000E187390
7.887018047741869189641330167452593390204386705619074761135437798419392435689195792476852434487192986E187389
Note the E's.
Here is my code:-
angles = []
a=<number too big to put here>
b=<number too big to put here>
c=<number too big to put here>
angles.append(degrees(acos((decimal.Decimal(b) ** 2 + decimal.Decimal(c) ** 2 - decimal.Decimal(a) ** 2) / (2 * decimal.Decimal(b) * decimal.Decimal(c)))))
angles.append(degrees(acos((decimal.Decimal(c) ** 2 + decimal.Decimal(a) ** 2 - decimal.Decimal(b) ** 2) / (2 * decimal.Decimal(c) * decimal.Decimal(a)))))
angles.append(degrees(acos((decimal.Decimal(a) ** 2 + decimal.Decimal(b) ** 2 - decimal.Decimal(c) ** 2) / (2 * decimal.Decimal(a) * decimal.Decimal(b)))))
The error I get is:-
Traceback (most recent call last):
File "G:/Python Projects/perfectTriangle1/testangle.py", line 13, in <module>
angles.append(degrees(acos((decimal.Decimal(b) ** 2 + decimal.Decimal(c) ** 2 - decimal.Decimal(a) ** 2) / (2 * decimal.Decimal(b) * decimal.Decimal(c)))))
decimal.InvalidOperation: [<class 'decimal.InvalidOperation'>]
When I print a, b and c, Python shows them a inf (infinity), which is why I believe it's falling over. Too big.
Is there a way to work with numbers of this size in Python?
Added note: I did previous look at the suggested link/duplicate, but it unfortunately does not solve the issue with numbers of this size.