Joshimello / AL2Lab

Calculator for factory game Assembly Line 2
https://al2lab.vercel.app
0 stars 2 forks source link

Numbers decimals should be changed #3

Open DatHaker123 opened 11 months ago

DatHaker123 commented 11 months ago

The things per second in the List tab are fixed to 1 decimal place by toFixed(1) in src/routes/al2/list.svelte. The 1 should be replaced by something along the lines of:

Math.floor(num) === num ? 0 : num.toString().split(".")[1].length || 0

instead, where num is the number of items/sec given by the user. This will improve things if the user inputs a decimal number.

Similarly, when inputting a decimal number, in the Data tab, we get the classic:

image

Joshimello commented 11 months ago

Mmm awesome idea, will implement! For the data tab part, oops overlooked that issue haha, will fix too~

Joshimello commented 11 months ago

oke added d3af475

DatHaker123 commented 11 months ago

We should keep 2 extra decimal places instead of just 1 more than the input, because of this:

image

Should be 0.25 but rounds up to 0.3

Joshimello commented 11 months ago

Made a dirty simple fix 7a3be0f But numbers getting a little messy, I might have to rethink how to display numbers.

Edit: actually not too bad...