MattyIce / steem-engine

Website for the Steem Smart Contracts project
6 stars 21 forks source link

Urgent: Preserve 3 decimal places without rounding up #77

Closed DoctorLai closed 5 years ago

DoctorLai commented 5 years ago

Regarding to PR: https://github.com/MattyIce/steem-engine/pull/68/files The function formatSteemAmount will not have 3 decimal places for input values less than 3 decimal places. For example, formatSteemAmount(3.1) will return "3.1"

image

This will be a problem for steem-js as it is expecting exactly 3 digits.

Therefore, I have made a function that does exactly this purpose: preserve 3 decimal places without rounding: see my blog: https://helloacm.com/javascripts-tofixed-implementation-without-rounding/

Vheissu commented 5 years ago

Lovely thank you @DoctorLai