Internet Explorer strips decimals

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • User999
    New Member
    • Feb 2012
    • 3

    Internet Explorer strips decimals

    I have the following problem with IE when making calculations with floating-point numbers.

    For instance, I have a div, which width is 150px and length 150px. I am subtracting say 15.787754565454 64 from its width.

    Code:
    div.style.width = (parseFloat(div.style.width) - 15.78775456545464) + "px";
    All major browsers return 134.21224543454 537 px, but IE returns 134.21. Internet Explorer removes all the decimals, but the first TWO.

    I'm using IE 10.

    Is there a way to return all decimals in IE?
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    in this case you must not have any decimals at all. no browser I know can display decimals on a pixel.

    Comment

    • User999
      New Member
      • Feb 2012
      • 3

      #3
      In my case those decimals make difference. But thank you anyway for your reply @Dormilich .

      I've managed to solve my problem.

      Comment

      Working...