News for hackers. Stuff that matters.
Re:Stage 3 Proposal: Array.prototype.at by runarberg on Wednesday June 02, 2021 @03:22PM (#27372867)
How do you fake BigDecimal with BigInt? My immediate intuition would have a 3-tuple (a, b, c) which would construct the decimal with a representing the numbers before the decimal separator, b the number of zeroes immediately after the decimal separator, and c the numbers after the zeroes. e.g. 1.000054 would be represented as `[1n, 4n, 54n]` and 3.14159 as `[3n, 0n, 14159n]`.

Is there a better way?

Re:Stage 3 Proposal: Array.prototype.at by lbussell on Wednesday June 02, 2021 @03:59PM (#27373349)
What about a 2-tuple with two numbers, one being the BigInt and one being the exponent. So 1.000054 would be (1000054, -6) = 1000054*10^(-6).

Yours is probably more space efficient though.

Re:Stage 3 Proposal: Array.prototype.at by nine_k on Thursday June 03, 2021 @11:57AM (#27383283)
This is basically floating-point.

IEEE 754, BTW, allows for 10-based floats, but IDK if anybody uses it.

Re:Stage 3 Proposal: Array.prototype.at by wizzwizz4 on Wednesday June 02, 2021 @07:15PM (#27375196)
Yours is more space-efficient for real-world numbers.