Patashu / break_infinity.js

A replacement for decimal.js for incremental games who 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.
MIT License
201 stars 35 forks source link

Get Swarm Simulator and True Exponential to use break_infinity.js #10

Open Patashu opened 6 years ago

Patashu commented 6 years ago

Hevipelle's Antimatter Dimensions swapped from decimal.js to break_infinity.js. Once the update is out, I will provide the devs of these two incremental games also swap for that sick performance gainz.

AD script time improved by 4.5x after swapping from decimal.js to break_infinity.js. This could be your incremental game:

image

EDIT: Don't know what Idle Bouncer uses, can check that game too

EDIT 2: Apparently Trimps uses decimal.js?! Does that game even go above 1.78e308? EDIT 3: It uses it just to make it so breeding times don't flip out when you have an extremely small or large amount of Trimps.

erosson commented 6 years ago

You have my attention!

First step for swarmsim to use this is for https://github.com/erosson/swarm-numberformat to support it. Tried that by replacing require('decimal.js') with require('./break_infinity.js'), but something broke - will isolate the issue later, when I'm more awake.

I've been meaning to swap https://github.com/MikeMcl/decimal.js-light into swarmsim and compare its speed with decimal.js; now there's more competition. A decimal.js-light comparison here would make my decision easier, and give you a third perf chart to show off.

Patashu commented 6 years ago

If break_infinity.js is lacking a function you need to swap it onto decimal.js, let me know what it is and I will add it.

erosson commented 6 years ago

Thanks! #16 and #17 would be enough for this to work with swarm-numberformat, I think.

erosson commented 6 years ago

Thank you for the fixes! Found that swarmsim also needs #18. The other two fixes are enough to advertise that this works with swarm-numberformat, though! Added to its docs.