• Stars
    star
    158
  • Rank 236,114 (Top 5 %)
  • Language
    C#
  • License
    MIT License
  • Created about 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Double replacement for numbers that go over 1e308

BreakInfinity.cs

A C# port of break_infinity.js - a solution for incremental games which want to deal with very large numbers (bigger in magnitude than 1e308, up to as much as 1e(9e15) ) and want to prioritize speed over accuracy.

Installation

Just drop BigDouble.cs file into your Scripts folder and use BigDouble type instead of double in your scripts

BigDouble

BigDouble is a double replacement for very large numbers.

ToString() Formats

  • General
new BigDouble(105203122911321275.6).ToString() == "1.05203122911321E+17"
new BigDouble(105203122911321275.6).ToString("G") == "1.05203122911321E+17"
new BigDouble(105203122911321275.6).ToString("G0") == "1.05203122911321E+17"
new BigDouble(105203122911321275.6).ToString("G1") == "1E+17"
new BigDouble(105203122911321275.6).ToString("G4") == "1.052E+17"
  • Exponential
new BigDouble(105203122911321275.6).ToString("E") == "1.052031E+017"
new BigDouble(105203122911321275.6).ToString("E0") == "1E+017"
new BigDouble(105203122911321275.6).ToString("E4") == "1.0520E+017"
  • Fixed
new BigDouble(105203122911321275.6).ToString("F") == "105203122911321000.00"
new BigDouble(105203122911321275.6).ToString("F0") == "105203122911321000"
new BigDouble(105203122911321275.6).ToString("F4") == "105203122911321000.0000"

Credits

Patashu - for amazing library and major effort in porting to C#