Bug #75936 Ability to round to a number of significant figures
Submitted: 17 Feb 2015 17:14
Reporter: Michael Grazebrook Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: DML Severity:S4 (Feature request)
Version:6.1.6 OS:Any
Assigned to: CPU Architecture:Any

[17 Feb 2015 17:14] Michael Grazebrook
Description:
It's generally a good idea to round data to an appropriate number of significant figures to avoid misrepresenting its accuracy.

For example 0.0012345 rounded to 2 significant figures is 0.0012, 12345.67 would be 12000

How to repeat:
This expression has the desired functionality:

ROUND(@x,2-floor(LOG10(abs(@x))))

but it's ugly and hard for people who don't understand logarithms.

Suggested fix:
Provide a function to round a value to a number of significant figures.