Vital9,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
.total{
border: #FF0033 2px solid;
display: inline-block;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">
</script>
<script>
$(function() {
var e = $('form').find('input:text').keyup(function() {
var a = [0,0,0];
e.each(function() {
if(n = this.value.replace(/\D/g,'')*1) {
$(this.parentNode).find('span').each(function(i, e) {
var v = n * $(e).data('v');
$(e).text(v);
a[i+1] += v;
a[i+1] = +a[i+1].toFixed(3)
})
a[0] += n;
}
});
$('#total').html('<span>' + a.join('</span> <span>') + '</span>')
})
});
</script>
</head>
<body>
<form>
<div><input type="text" name="salt" />В: <span data-v="2">a1</span> Н: <span data-v="4.89">a2</span></div>
<div><input type="text" name="pepper" />В: <span data-v="32">b1</span> Н: <span data-v="1.789">b2</span></div>
<div><input type="text" name="sugar" />В: <span data-v="12">c1</span> Н: <span data-v="3.098">c2</span></div>
</form>
<b class="total"><div id="total"></div> это id="total" тут всё округляется</b>
</body>
</html>