By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,986 Members | 1,960 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,986 IT Pros & Developers. It's quick & easy.

Internet Explorer strips decimals

P: 3
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.78775456545464 from its width.

Expand|Select|Wrap|Line Numbers
  1. div.style.width = (parseFloat(div.style.width) - 15.78775456545464) + "px";
All major browsers return 134.21224543454537 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?
Oct 4 '13 #1
Share this Question
Share on Google+
2 Replies


Dormilich
Expert Mod 5K+
P: 8,639
in this case you must not have any decimals at all. no browser I know can display decimals on a pixel.
Oct 5 '13 #2

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

I've managed to solve my problem.
Oct 5 '13 #3

Post your reply

Sign in to post your reply or Sign up for a free account.