Patashu / break_eternity.js

A Javascript numerical library to represent numbers as large as 10^^1e308 and as small as 10^-10^^1e308. Sequel to break_infinity.js, designed for incremental games.
MIT License
122 stars 46 forks source link

Make D return a Readonly<Decimal> #89

Closed mcpower closed 2 years ago

mcpower commented 2 years ago

As D returns the provided value as-is, it is easy to accidentally use it to create a "copy" of a Decimal and mutate it... without realising that the original Decimal was mutated too.

As a result, this commit fixes iteratedlog, slog and layeradd10 mutating the original Decimal (presumably accidentally), and prevents this from occurring in the future, as it is now a TypeScript error to mutate a value returned from D.