SQL PHP HTML ASP JavaScript articles and free scripts to download
 

Floor function to get just lower integer of a number

We can use math function floor to get the floor of a number or the largest integer which is equal to or lower than the given number.

So by using floor we can get the floor value of an number.

Here is the syntax.


Math.floor(number)



Let us try with some examples.





document.write (Math.floor(11.257)); // output 11
document.write ("<br>----<br>");

document.write (Math.floor(1.56)); // output 1
document.write ("<br>----<br>");


document.write (Math.floor(-3.564)); // output -4
document.write ("<br>----<br>");


document.write (Math.floor(-7.164)); // output -8
document.write ("<br>----<br>");


You can read the php math floor function
Further readings
random() function to generate random numbers
round() function to get rounded value of a number
IsNaN() function to check data if number or not
ceil() function to get just next higher integer
floor() function to get just highest lower integer
toFixed() function to format decimal places of a number
toPrecision() function to fix the places of a number
parseFloat() function to convert string to number
 
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.

Scripts
PHP
JavaScript
JavaScript Tutorials
Math Functions
Popular Tutorials
Drop down list
Timer function
JavaScript Tutorials
String
Array
Date & Time
Form Validation
Event Handling
Math Functions
JavaScript Forum
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.