Categories
- General (22)
- Talking (10)
- Thinking (58)
- Apple (2)
- Browsers (4)
- Business (16)
- Databases (6)
- MySQL (3)
- SQL Server (1)
- Design (3)
- E-commerce (3)
- Marketing (2)
- Mobile (1)
- Networking (2)
- Programming (30)
- ColdFusion (24)
- Java (1)
- Javascript (6)
- PHP (6)
- Ruby (1)
- Web 2.0 (3)
- Web Servers (3)
- IIS (3)
- Windows (11)
- Walking (1)
Archives
- July 2010 (1)
- June 2010 (1)
- March 2010 (1)
- February 2010 (1)
- January 2010 (13)
- December 2009 (3)
- July 2009 (2)
- June 2009 (1)
- May 2009 (1)
- April 2009 (8)
- March 2009 (6)
- February 2009 (15)
- January 2009 (4)
- December 2008 (3)
- November 2008 (2)
- September 2008 (2)
- August 2008 (2)
- November 2007 (2)
- September 2007 (1)
- April 2007 (5)





Fix/Int (Floor) function oddity in ColdFusion 8
I’ve discovered an odd little “bug” in the Fix and Int functions in ColdFusion 8. The Fix/Int functions work similarly to the Floor function in other languages:
According to the ColdFusion 8 LiveDocs
Int - Calculates the closest integer that is smaller than number. For example, it returns 3 for Int(3.3) and for Int(3.7); it returns -4 for Int(-3.3) and for Int(-3.7)
Fix – Converts a real number to an integer. If number is greater than or equal to 0, the closest integer less than or equal to number. If number is less than 0, the closest integer greater than or equal to number.
Now, if you do #Fix(15)# or #Int(15)# the functions return the correct value of 15. However if you do #Fix((6.84/45.60) * 100)# or #Int((6.84/45.60) * 100)# the functions return 14 which is incorrect since the equation equates to 15.
Bug or Feature?
Related Posts