arbitrary big numbers

How do calculators store numbers up to one googol (1e100)? How can I replicate this in c#?
6 Replies
Pobiega
Pobiega12mo ago
BigInteger assuming integers. If you need arbitrarily large floating point numbers, I think the go-to would be BigDecimal
cap5lut
cap5lut12mo 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ᵈᵉᵛOP12mo ago
I could also just use double 🤦🏼🤦🏼🤦🏼
cap5lut
cap5lut12mo 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ᵈᵉᵛOP12mo ago
I know, but afaik, doubles are always precise on 15-17 digits after the first one? So 1e100+1e84≠1e100
cap5lut
cap5lut12mo ago
yeah something like that
Want results from more Discord servers?
Add your server