Questions tagged [parsefloat]

parseFloat is a global JavaScript method which parses an argument, and returns a number.

JavaScript's parseFloat attempts to parse the first argument, and returns a number. If the argument cannot be parsed, parseFloat returns NaN.

A comparison of number conversion methods can be found at this answer.

222 questions
-1
votes
1 answer

JavaScript: turn a string into a number and then turn it back to string

I'm receiving some data which I need to turn them to numbers, make some computation with that and then I need to use the same data in another place but as a string. I'm using parseFloat() but the problem is that it already removes the letters part…
Ilir
  • 488
  • 5
  • 20
-1
votes
1 answer

Golang Truncating Float32 From Scanner Input

I am attempting to create a program where you can input a float32 into a scanner, and have the output be a truncation of the float, removing all digits from the right of the decimal place. Example: Input: 6.7777 Output: 6 The problem I'm having…
CodeDragon
  • 29
  • 7
-1
votes
1 answer

This Java code is running perfectly in IDE but not on codechef. Can anyone tell me why this exception is coming?

It's working fine in IDE but got null pointer exception on Codechef. on the second line "parseFloat" it's getting null pointer exception can anyone solve this issue? BufferedReader br = new BufferedReader(new…
-1
votes
1 answer

parseFloat is doubling operand in animation

I'm very new to JavaScript and to coding in general. I'm creating an animation that expands and contract an image to simulate breathing. I am also adding a "breath count" to count the number of breaths. This is the code I used to create the breath…
Farrah A
  • 1
  • 1
-1
votes
1 answer

parseFloat returning NaN for Celsius to Fahrenheit

I am trying to write some logic to convert Celsius to Fahrenheit and when passed a negative value, it returns NaN. Not sure why. Here is my Fahrenheit offset: const fahrenheitOffset = (value) => (value * 1.8) + 32; and here is my function: function…
StuffedPoblano
  • 675
  • 1
  • 12
  • 35
-1
votes
5 answers

parseFloat is not working

I don't know why I'm stumped on this simple problem, but I'm trying to test a simple clicker game with parseFloat(). But it won't work! Any ideas?: