JSFiddle - React, Tailwind, and code Playground

HTML

<table border="1">
    <tr>
        <th>val</th>
        <th>step</th>
        <th>result</th>
    </tr>
    <tr id="1"></tr>
    <tr id="2"></tr>
    <tr id="3"></tr>
</table>

CSS

table td, table th {
    padding: 6px;
}

JavaScript

function checkStep(val, min, step) {
    var ret,
        diff,
        moddedDiff;
    var pows = 0;
    while( step < 1 ) { // make sure step is > 1
        step *= 10;
        val *= 10;
        min *= 10;
        pows++;
    }
    diff = val - min;
    moddedDiff = diff % step;
    ret = val - moddedDiff;
    return ret / Math.pow( 10, pows );
}

$('#1').html( "<td>5.5</td><td>1</td><td>" 
    + checkStep( 5.5, 0, 1 ) + "</td>" );
$('#2').html( "<td>5.5</td><td>2</td><td>" 
    + checkStep( 5.5, 0, 2 ) + "</td>" );
$('#3').html( "<td>0.5</td><td>0.1</td><td>" 
    + checkStep( 0.5, 0, 0.1 ) + "</td>" );