Floating point numbers are often known as floats. They are numbers or a combination of numbers with a decimal point in it.

An example of a floating point would be: 

<?php
    $float = 7.2;
?>

Floating point numbers have limited precision. They use the IEEE 754 double precision format which gives maximum error while rounding off with the order of 1.11e-16. Therefore, it is unnecessary to compare floating point numbers for equality.

Whenever a string does not contain any characters but numbers that fit the integer type, it will be evaluated as integer. In all other instances, it will be evaluated as float.

Example of a floating point data type

Numeric operations can result in a value represented by NaN (not-a-number). That is an undefined floating point calculation and any comparison may result into FALSE. 

 

›› go to examples ››