arbitrary big numbers

How do calculators store numbers up to one googol (1e100)? How can I replicate this in c#?
6 Replies
Pobiega
Pobiega7mo ago
BigInteger assuming integers. If you need arbitrarily large floating point numbers, I think the go-to would be BigDecimal
cap5lut
cap5lut7mo ago
note that there is no BigDecimal implementation in the BCL, so for that u would need to find a suitable nuget package
IKryxxᵈᵉᵛ
IKryxxᵈᵉᵛ7mo ago
I could also just use double 🤦🏼🤦🏼🤦🏼
cap5lut
cap5lut7mo ago
depends on the precision u need ;p the farther away the value is from 0 the less precise is a floating point number no matter if we are talking about half, single or double
IKryxxᵈᵉᵛ
IKryxxᵈᵉᵛ7mo ago
I know, but afaik, doubles are always precise on 15-17 digits after the first one? So 1e100+1e84≠1e100
cap5lut
cap5lut7mo ago
yeah something like that