Results 1 to 6 of 6
Hybrid View
-
30th August 2010 19:18 #1Banned
Join Date: Oct:2003
Location:
Posts: 5,259
.
:
8echo (int) ((0.4+0.4) * 10 );
:
7echo (int) ((0.1+0.7) * 10 );
8!echo (float) ((0.7+0.1) * 10 );
.1+.7 .8
7 7.9999, (int) 7. cast- , PHP ?
, !
!
-
30th August 2010 19:28 #2
-
30th August 2010 19:33 #3Banned
Join Date: Oct:2003
Location:
Posts: 5,259
-
30th August 2010 19:39 #4Registered User
Join Date: Aug:2006
Location:
Posts: 4,052
float- . - .
add (1): http://en.wikipedia.org/wiki/Floating_point
-
30th August 2010 19:42 #5
-
31st August 2010 10:39 #6
-, :
.PHP Code:<?
printf("%.25f != %.25f\n", 0.1+0.7, 0.8);
printf("%.25f == %.25f\n", 0.4+0.4, 0.8);
printf("0.1 != %.25f\n", 0.1);
printf("0.7 != %.25f\n", 0.7);
printf("0.4 != %.25f\n", 0.4);
printf("0.8 != %.25f\n", 0.8);
?>
0.7999999999999999333866185 != 0.8000000000000000444089210
0.8000000000000000444089210 == 0.8000000000000000444089210
0.1 != 0.1000000000000000055511151
0.7 != 0.6999999999999999555910790
0.4 != 0.4000000000000000222044605
0.8 != 0.8000000000000000444089210Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others




Reply With Quote

Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in