Skip to content

codebyko.se

N/A

  • WordPress Plugins

Month: October 2011

MySQL round half even emulation

I needed to emulate php’s PHP_ROUND_HALF_EVEN behaviour in mysql and did this:

SELECT IF(MOD(col,2)=1.5), FLOOR(col), ROUND(col))

Where col is a float value.

Edit: It seems as mysql’s ROUND() function does this per default. I should have read TFM.

Author karloskarPosted on 5 October, 201110 December, 2015Leave a comment on MySQL round half even emulation

Recent Posts

  • Flask-SQLAlchemy ssl-connection
  • Initialize WordPress development
  • Set mtime with part of filename
  • MySQL round half even emulation
  • Bring focus to Empathy in Unity

Recent Comments

  • Rob Cranfill on tracd with upstart on Ubuntu

Archives

  • March 2014
  • December 2012
  • May 2012
  • October 2011
  • May 2011
  • November 2010

Categories

  • Okategoriserade

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
  • WordPress Plugins
codebyko.se Proudly powered by WordPress
7ads6x98y