0

It’s me again. I’ve been trying everything, but it goes in one ear and out the other.

How do I truncate a floating-point number?

I’ve tried Math.floor, round, toFixed and so on.

What do I should do about it?

var off = 10/100;
var value = 25.55;

var final = value-off * value;

$("#teste").val(final.toFixed(2));
<!Doctype html>
<html>
<head> 
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
  
  <title> Hallo Leute! Alles klar,nö? Helfe mir! :D </title>
</head>
  
<body> 
  
 <input type="text" name="test" id="teste">     
  <p> I'd like see result : 29.99 </p>
</body>  
  
  
 </html>
Rory O'Kane
  • 29,210
  • 11
  • 96
  • 131
Ariöl V
  • 33
  • 6

0 Answers0