This bugzilla service is closed. All entries have been migrated to
Bug 1528 - Floating point underflow exception in tolerance computation
Summary: Floating point underflow exception in tolerance computation
Alias: None
Product: Eigen
Classification: Unclassified
Component: Cholesky (show other bugs)
Version: 3.4 (development)
Hardware: x86 - 64-bit Linux
: Normal Unknown
Assignee: Nobody
Depends on:
Reported: 2018-03-14 12:57 UTC by Anders Sundman
Modified: 2019-12-04 17:32 UTC (History)
3 users (show)

patch (1.13 KB, patch)
2018-03-15 16:38 UTC, Anders Sundman
no flags Details | Diff
same patch with comment cleanup (1.37 KB, patch)
2018-03-15 16:44 UTC, Anders Sundman
no flags Details | Diff

Description Anders Sundman 2018-03-14 12:57:14 UTC
In src/Cholesky/LDLT.h there is the line:

RealScalar tolerance = RealScalar(1) / NumTraits<RealScalar>::highest();

This causes a floating point underflow exception in the CPU. It is normally not handled by applications and is silently ignored. But we run with: 


Using min() seems to work fine for us: 

RealScalar tolerance = std::numeric_limits<RealScalar>::min();
Comment 1 Christoph Hertzberg 2018-03-14 13:53:54 UTC
I think that change should be fine. std::numeric_limits::min is also used in the SVD module and the EigenSolver module at many places.
Comment 2 Anders Sundman 2018-03-15 13:13:17 UTC
Unfortunatly the tests fail for the min() change since the <cmath> include has a min() define that leaks in to this file when used in the tests. So some reordering and adding of includes in some test files is probably also required.
Comment 3 Christoph Hertzberg 2018-03-15 14:09:56 UTC
Try (std::numeric_limits<RealScalar>::min)()
Comment 4 Anders Sundman 2018-03-15 16:38:36 UTC
Created attachment 835 [details]
Comment 5 Anders Sundman 2018-03-15 16:43:25 UTC
Top notch hackery ;) 

Seems to work. tests pass.
Comment 6 Anders Sundman 2018-03-15 16:44:36 UTC
Created attachment 836 [details]
same patch with comment cleanup

add comment about macro expansion 
remove comments about historic implementations
Comment 8 Nobody 2019-12-04 17:32:04 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance:

Note You need to log in before you can comment on or make changes to this bug.