Balance from division to 1. Determination of the fragment of the decimal place
The numbers are in the form of a decimal place. We have to do arithmetic surgery with them, and then we need to record a rounded response. I understand that the accuracy must be preserved, that is, if we have a number of two signs after the comma, in general, the same accuracy must be taken.
(1) In simple case, how does the float separate the fragment?
(2) In a more complex case: as a type of 3.26000, distinguish the fragment of 0.26000 (accuracy 5)
I'm already trying to swap the line for the point position. embarrassment
PHP (primarily), JS(almost interesting)
P.S. found the current fmod. But it's a mess, too, isn't it?
$a = 3.26000; printf('%.5f',$a-intval($a));
If the number of signs is unknown, it will have to be ruptured and counted as length.
var i = 3.32000; console.log((i-~~i).toFixed(5));