Double Type in PHP

Filed in php-lesson1(variables) 0 comments

doubles are floating point-numbers
I wil exmaple a double
Example:

$My_double = 385.874;
$My_double2 = 1.5;
$My_double3 = 0.556;
$My_double4 = 9.0;
$My_double5 = 0.00003;

when doubles are having a rounded number it will not save it as an integer, and will keep its type of format as a double

$another_double = $My_double4 + 10;

that will produce a doule number that is 19.0 while the 19.0 and 19 hasthe same meaning but the type of format where it has stored in the meemory is diffrent from each other

another point to tell is that the doubles store the minimal decimal value meaning that
19.00 wont be stored and the minimum is 19.0
Exmaple:
[cc lang="php"]
$My_d1 = 1.999;
$My_d2 = 0.111;
$The_Sum = $My_d1 + $My_d2;
print(“$The_Sum”)
the result is:2.0 instead of 2.000

voshka

Related posts:

  1. Variable Types in PHP
  2. Integer Type in PHP
Posted by voshka   @   6 March 2010 0 comments

Share This Post

RSS Digg Twitter StumbleUpon Delicious Technorati

0 Comments

No comments yet. Be the first to leave a comment !
Leave a Comment

Previous Post
«
Next Post
»
CrossBlock designed by DeltaManual.Com  |  In conjunction with Web Hosting   |   Web Hosting   |   Reverse phone