j0hnik,
<script>
function fn(plosh)
{ var koef = 1;
for (var i=0,k = 3; k < plosh; i++) {
k += (i + 1)% 3 ? .3 : .4;
k = +k.toFixed(1)
koef -= i ? 0.01 : 0.02 ;
koef = +koef.toFixed(2)
}
return koef
}
var test = [3,3.3,3.6,4,4.3,4.6,5,5.3];
function foo(plosh)
{
var koef = (1 - (plosh - 3) / 33).toPrecision(2);
return +koef
}
for (var i=0; i<test.length; i++) {
var plosh = test[i];
document.write([plosh.toFixed(1),fn(plosh),foo(plosh) ].join(" = ")+"<br>")
}
document.write("<br>");
for (var i=0; i<test.length; i++) {
var plosh = test[i]+.1;
document.write([plosh.toFixed(1),fn(plosh),foo(plosh) ].join(" = ")+"<br>")
}
</script>