phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


PHP Basic: Floating-Point Data Type

Tag: data type, floating point   Category: PHP Basic
post: 01 Mar 2008 read: 76


PHP Basic Data Type Step By Step Tutorial - Part 4: Floating-Point data type is the number of data type of float, double, or real and it is able to be expressed with form as follow:

$ x = 1.234;
$ x = 1.2e3;
$ x = 7E-10;

The reach number of float depends on platform, maximum ~1.8e308 with the correctness of 14 digit.

Pay attention to the example of using float data type at script as following :

File name : floating_point.php


<Html>
<head>
<title>Floating-Point Data Type</title>
</head>
<body>
<h1>Floating-Point Data Type</h1>
<?
	$a = 2.5e30;
	$b = 7.0;
	$c = $a * $b;
	echo "a = $a"."<br>";
	echo "b = $b"."<br>";
	echo "c = $c"."<br><br>";
?>
</body>
</html>

The result of executing floating_point.php:

php basic - floating point data type



| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
mod_rewrite - Part 1: create your "fantasy" URL

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting