Page 1 of 1

Very minor bug - mph to km/h conversion

Posted: Thu 15 Jun 2023 7:59 am
by Grimers
Hi Mark & others,

Just noticed that even though the gauges.js script is converting mph to km/h correctly, the actual output is showing 1 mph as 1.4 km/h, so it doesn't round to 2 km/h when using rounded values. Not a biggie just wondering if there's a reason for this?

Cheers,

Will

Re: Very minor bug - mph to km/h conversion

Posted: Thu 15 Jun 2023 8:37 am
by water01
I might not be understanding you correctly but my understanding of rounding is that if the number is less than 5 round down and if more than 5 round up, so I would say this is correct.

Re: Very minor bug - mph to km/h conversion

Posted: Thu 15 Jun 2023 12:15 pm
by jpsc
It's the 1.4kph that is wrong, it should be 1mph converted to 1.6kph rounding to 2kph

Re: Very minor bug - mph to km/h conversion

Posted: Thu 15 Jun 2023 12:50 pm
by Mapantz
I get 1.4 kmh as my lowest value. All other values above it are correct when converting back to mph.

So yeah, it should be 1.6 kmh.

Re: Very minor bug - mph to km/h conversion

Posted: Fri 16 Jun 2023 3:03 pm
by Grimers
Thought so, thanks all. I have tried to change the rounding but no luck it's stuck at 1.4 km/h. I guess Mark may need to make a (hopefully) small change, but like I say it's very minor.