Javascript parseFloat() change number [closed]












0















I have a strange problem with JavaScript .
I have text value in a textbox '25000000' when i am
using parsefloat(txt.value), the returned value is 25000 !??



Why is 25000000 changed to 25000 ?










share|improve this question















closed as off-topic by James Thorpe, Tetsuya Yamamoto, Madhur Bhaiya, sideshowbarker, Paul Roub Nov 26 '18 at 22:48


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – James Thorpe, Tetsuya Yamamoto, Madhur Bhaiya, sideshowbarker, Paul Roub

If this question can be reworded to fit the rules in the help center, please edit the question.












  • 1





    Is it definitely all zeros? If there was an O hidden in there instead for instance, the parseFloat would stop at that point and return just what had been parsed so far. Other than that, there's not really enough information in your question to give you an answer.

    – James Thorpe
    Nov 26 '18 at 9:13













  • txt.value from input?

    – Mars.Tsai
    Nov 26 '18 at 9:14






  • 1





    Can you provide a minimal, complete and verifiable example that demonstrates the problem?

    – James
    Nov 26 '18 at 9:22


















0















I have a strange problem with JavaScript .
I have text value in a textbox '25000000' when i am
using parsefloat(txt.value), the returned value is 25000 !??



Why is 25000000 changed to 25000 ?










share|improve this question















closed as off-topic by James Thorpe, Tetsuya Yamamoto, Madhur Bhaiya, sideshowbarker, Paul Roub Nov 26 '18 at 22:48


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – James Thorpe, Tetsuya Yamamoto, Madhur Bhaiya, sideshowbarker, Paul Roub

If this question can be reworded to fit the rules in the help center, please edit the question.












  • 1





    Is it definitely all zeros? If there was an O hidden in there instead for instance, the parseFloat would stop at that point and return just what had been parsed so far. Other than that, there's not really enough information in your question to give you an answer.

    – James Thorpe
    Nov 26 '18 at 9:13













  • txt.value from input?

    – Mars.Tsai
    Nov 26 '18 at 9:14






  • 1





    Can you provide a minimal, complete and verifiable example that demonstrates the problem?

    – James
    Nov 26 '18 at 9:22
















0












0








0








I have a strange problem with JavaScript .
I have text value in a textbox '25000000' when i am
using parsefloat(txt.value), the returned value is 25000 !??



Why is 25000000 changed to 25000 ?










share|improve this question
















I have a strange problem with JavaScript .
I have text value in a textbox '25000000' when i am
using parsefloat(txt.value), the returned value is 25000 !??



Why is 25000000 changed to 25000 ?







javascript asp.net






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '18 at 10:00









JustLearning

1,24421637




1,24421637










asked Nov 26 '18 at 9:10









Ali RadAli Rad

243




243




closed as off-topic by James Thorpe, Tetsuya Yamamoto, Madhur Bhaiya, sideshowbarker, Paul Roub Nov 26 '18 at 22:48


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – James Thorpe, Tetsuya Yamamoto, Madhur Bhaiya, sideshowbarker, Paul Roub

If this question can be reworded to fit the rules in the help center, please edit the question.







closed as off-topic by James Thorpe, Tetsuya Yamamoto, Madhur Bhaiya, sideshowbarker, Paul Roub Nov 26 '18 at 22:48


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – James Thorpe, Tetsuya Yamamoto, Madhur Bhaiya, sideshowbarker, Paul Roub

If this question can be reworded to fit the rules in the help center, please edit the question.








  • 1





    Is it definitely all zeros? If there was an O hidden in there instead for instance, the parseFloat would stop at that point and return just what had been parsed so far. Other than that, there's not really enough information in your question to give you an answer.

    – James Thorpe
    Nov 26 '18 at 9:13













  • txt.value from input?

    – Mars.Tsai
    Nov 26 '18 at 9:14






  • 1





    Can you provide a minimal, complete and verifiable example that demonstrates the problem?

    – James
    Nov 26 '18 at 9:22
















  • 1





    Is it definitely all zeros? If there was an O hidden in there instead for instance, the parseFloat would stop at that point and return just what had been parsed so far. Other than that, there's not really enough information in your question to give you an answer.

    – James Thorpe
    Nov 26 '18 at 9:13













  • txt.value from input?

    – Mars.Tsai
    Nov 26 '18 at 9:14






  • 1





    Can you provide a minimal, complete and verifiable example that demonstrates the problem?

    – James
    Nov 26 '18 at 9:22










1




1





Is it definitely all zeros? If there was an O hidden in there instead for instance, the parseFloat would stop at that point and return just what had been parsed so far. Other than that, there's not really enough information in your question to give you an answer.

– James Thorpe
Nov 26 '18 at 9:13







Is it definitely all zeros? If there was an O hidden in there instead for instance, the parseFloat would stop at that point and return just what had been parsed so far. Other than that, there's not really enough information in your question to give you an answer.

– James Thorpe
Nov 26 '18 at 9:13















txt.value from input?

– Mars.Tsai
Nov 26 '18 at 9:14





txt.value from input?

– Mars.Tsai
Nov 26 '18 at 9:14




1




1





Can you provide a minimal, complete and verifiable example that demonstrates the problem?

– James
Nov 26 '18 at 9:22







Can you provide a minimal, complete and verifiable example that demonstrates the problem?

– James
Nov 26 '18 at 9:22














2 Answers
2






active

oldest

votes


















0














I think there is an alphabet somewhere in your numbers. Check the example below.There is an error in your code.



parseFloat(" 250000000 ") = 250000000
parseFloat("2018@geeksforgeeks") = 2018
parseFloat("geeksforgeeks@2018") = NaN





share|improve this answer































    0














    Thanks for all Responses.
    The problem was for ',' in price.
    Of course we replace ',' with '' ,but replace method
    only change first one like "25,000,000,000"=>"25000,000,000".
    I used str.split(',').join('') and problem solve and parsefloat returned correctly.
    regards
    ali






    share|improve this answer






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      I think there is an alphabet somewhere in your numbers. Check the example below.There is an error in your code.



      parseFloat(" 250000000 ") = 250000000
      parseFloat("2018@geeksforgeeks") = 2018
      parseFloat("geeksforgeeks@2018") = NaN





      share|improve this answer




























        0














        I think there is an alphabet somewhere in your numbers. Check the example below.There is an error in your code.



        parseFloat(" 250000000 ") = 250000000
        parseFloat("2018@geeksforgeeks") = 2018
        parseFloat("geeksforgeeks@2018") = NaN





        share|improve this answer


























          0












          0








          0







          I think there is an alphabet somewhere in your numbers. Check the example below.There is an error in your code.



          parseFloat(" 250000000 ") = 250000000
          parseFloat("2018@geeksforgeeks") = 2018
          parseFloat("geeksforgeeks@2018") = NaN





          share|improve this answer













          I think there is an alphabet somewhere in your numbers. Check the example below.There is an error in your code.



          parseFloat(" 250000000 ") = 250000000
          parseFloat("2018@geeksforgeeks") = 2018
          parseFloat("geeksforgeeks@2018") = NaN






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 26 '18 at 9:16









          lutakynlutakyn

          7211




          7211

























              0














              Thanks for all Responses.
              The problem was for ',' in price.
              Of course we replace ',' with '' ,but replace method
              only change first one like "25,000,000,000"=>"25000,000,000".
              I used str.split(',').join('') and problem solve and parsefloat returned correctly.
              regards
              ali






              share|improve this answer




























                0














                Thanks for all Responses.
                The problem was for ',' in price.
                Of course we replace ',' with '' ,but replace method
                only change first one like "25,000,000,000"=>"25000,000,000".
                I used str.split(',').join('') and problem solve and parsefloat returned correctly.
                regards
                ali






                share|improve this answer


























                  0












                  0








                  0







                  Thanks for all Responses.
                  The problem was for ',' in price.
                  Of course we replace ',' with '' ,but replace method
                  only change first one like "25,000,000,000"=>"25000,000,000".
                  I used str.split(',').join('') and problem solve and parsefloat returned correctly.
                  regards
                  ali






                  share|improve this answer













                  Thanks for all Responses.
                  The problem was for ',' in price.
                  Of course we replace ',' with '' ,but replace method
                  only change first one like "25,000,000,000"=>"25000,000,000".
                  I used str.split(',').join('') and problem solve and parsefloat returned correctly.
                  regards
                  ali







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 26 '18 at 11:17









                  Ali RadAli Rad

                  243




                  243















                      Popular posts from this blog

                      To store a contact into the json file from server.js file using a class in NodeJS

                      Redirect URL with Chrome Remote Debugging Android Devices

                      Dieringhausen