« REPEAT() :: MySQL Function of the Day | Main | MySQL Pop Quiz #15 »
FLOOR() :: MySQL Function of the Day
By Carsten | March 17, 2008
Function name: FLOOR()
Aliases: -
Function type: Mathematical function
Purpose: Round down to nearest integer
Description: If x is an integer value (or a decimal/floating point value with all-zeroes in the decimal part), FLOOR(x) returns x. Otherwise, FLOOR(x) returns the next lower integer value. Example: FLOOR(2.34) returns 2.
This is true also for negative values: FLOOR(-2.34) returns -3, not -2 as you might otherwise expect.
[fadps]
Topics: MySQL Function of the day |
March 18th, 2008 at 3:11 pm
Oops! “Example: FLOOR(2.34) returns -2″ should be “Example: FLOOR(2.34) returns 2″.
Steve Breese
Certified MySQL 5.0 Developer
March 18th, 2008 at 9:20 pm
Oops indeed. Corrected, thanks!
April 21st, 2008 at 12:15 pm
[...] Monday, March 17, 2008: FLOOR() [...]