From 4adeababf90f318cd2181a945211bae83fdea930 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 16 Sep 2016 11:46:46 +0200 Subject: Fix undeflow --- test/svd_fill.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'test/svd_fill.h') diff --git a/test/svd_fill.h b/test/svd_fill.h index a705fa011..a1f752c66 100644 --- a/test/svd_fill.h +++ b/test/svd_fill.h @@ -7,6 +7,14 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +template +Array four_denorms(); + +template<> +Array4f four_denorms() { return Array4f(5.60844e-39f, -5.60844e-39f, 4.94e-44f, -4.94e-44f); } +template<> +Array4d four_denorms() { return Array4d(5.60844e-313, -5.60844e-313, 4.94e-324, -4.94e-324); } + template void svd_fill_random(MatrixType &m, int Option = 0) { @@ -55,7 +63,8 @@ void svd_fill_random(MatrixType &m, int Option = 0) } Matrix samples(9); - samples << 0, 5.60844e-313, -5.60844e-313, 4.94e-324, -4.94e-324, -RealScalar(1)/NumTraits::highest(), RealScalar(1)/NumTraits::highest(), (std::numeric_limits::min)(), pow((std::numeric_limits::min)(),0.8); + samples << 0, four_denorms(), + -RealScalar(1)/NumTraits::highest(), RealScalar(1)/NumTraits::highest(), (std::numeric_limits::min)(), pow((std::numeric_limits::min)(),0.8); if(Option==Symmetric) { -- cgit v1.2.3