[Webkit-unassigned] [Bug 80009] Setting '0.6' to the value of a range input makes the value 0.6000000000000001

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 20 23:06:12 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=80009


yosin at chromium.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://jsfiddle.net/8Z5kq/




--- Comment #3 from yosin at chromium.org  2012-03-20 23:06:12 PST ---
Add another sample, it displays
0
0.1
0.2
0.30000000000000004
0.4
0.5
0.6000000000000001
0.7000000000000001
0.8
0.9

It is better to change double print function to use "%.15f"?

#include <stdio.h>
int main(int, char**) {
   for (int i = 1; i <= 9; i++) {
       double x = i * 0.1;
       printf("%d %f %.15f %.16f %.17f\n", i, x, x, x, x);
   }
   return 0;
}

1 0.100000 0.100000000000000 0.1000000000000000 0.10000000000000001
2 0.200000 0.200000000000000 0.2000000000000000 0.20000000000000001
3 0.300000 0.300000000000000 0.3000000000000000 0.30000000000000004
4 0.400000 0.400000000000000 0.4000000000000000 0.40000000000000002
5 0.500000 0.500000000000000 0.5000000000000000 0.50000000000000000
6 0.600000 0.600000000000000 0.6000000000000001 0.60000000000000009
7 0.700000 0.700000000000000 0.7000000000000001 0.70000000000000007
8 0.800000 0.800000000000000 0.8000000000000000 0.80000000000000004
9 0.900000 0.900000000000000 0.9000000000000000 0.90000000000000002

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list