summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@herrb.eu>2018-11-26 21:12:05 +0100
committerKevin Brace <kevinbrace@gmx.com>2018-11-29 10:29:40 -0800
commit11abbd45e0c93b672a7e8d5730560a6b351c7a9b (patch)
tree836ab955f3196abf8f497cf873b02485af4bc409
parent4ce40b932cdced590af1c32f6f491f63e9a247dd (diff)
Use fabs() to compute absolute value of floating point number.
Fixes a warning from clang and looks like it was a real bug. Signed-off-by: Matthieu Herrb <matthieu@herrb.eu> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/mga_dacG.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mga_dacG.c b/src/mga_dacG.c
index d5a7689..4e24595 100644
--- a/src/mga_dacG.c
+++ b/src/mga_dacG.c
@@ -961,8 +961,8 @@ MGAGCalcClock ( ScrnInfoPtr pScrn, long f_out,
/*
* Pick the closest frequency.
*/
- if ( abs(calc_f - f_vco) < m_err ) {
- m_err = abs(calc_f - f_vco);
+ if ( fabs(calc_f - f_vco) < m_err ) {
+ m_err = fabs(calc_f - f_vco);
*best_m = m;
*best_n = n;
}