diff options
author | Alexander Barkov <bar@mariadb.com> | 2019-03-19 22:14:37 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2019-03-20 13:17:24 +0400 |
commit | ef81d2ea64cc800565e18fb4436d0af1134b3315 (patch) | |
tree | 43f3cf628b52e522330667aad96ae42decda82f6 /sql/item_sum.cc | |
parent | 3b98c65c4e8b50b3000cbca643a5d3048cf1f7f7 (diff) | |
download | mariadb-git-ef81d2ea64cc800565e18fb4436d0af1134b3315.tar.gz |
Fixing "mtr func_math" failure in the test for MDEV-17643
Adding an intermediate volatile variable to avoid using co-processor registers
on some platforms (e.g. 32-bit x86).
This change makes test results stable accross all platforms.
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r-- | sql/item_sum.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 5e7ce270dc3..8ba5579646d 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1824,8 +1824,9 @@ static void variance_fp_recurrence_next(double *m, double *s, ulonglong *count, else { double m_kminusone= *m; - *m= m_kminusone + (nr - m_kminusone) / (double) *count; - *s= *s + (nr - m_kminusone) * (nr - *m); + volatile double diff= nr - m_kminusone; + *m= m_kminusone + diff / (double) *count; + *s= *s + diff * (nr - *m); } } |