-2

I need to convert values โ€‹โ€‹of type int32 to float values

I have the value of 39900 and I need to convert to 399.00, or 7400 to convert to 74.00 or 4378 to 43.78, they are not fixed values.

wiliamvj
  • 23
  • 1
  • 6
  • 3
    divide by 100? all numbers are floats in javascript. [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#number_encoding) โ€“ pilchard Feb 06 '23 at 17:26
  • If you're trying to *display* those with extra decimal points, just call `.toFixed(2)` which will return the string representation. โ€“ General Grievance Feb 06 '23 at 17:37

1 Answers1

0

You just need to divide the number by 100, this will put the last 2 digits in the fractions. You don't need to worry about integer and float weirdness from C-like languages, since in Javascript, all numbers are floats, as @pilchard has pointed out.

TopchetoEU
  • 697
  • 5
  • 9