ATLAS Offline Software
Loading...
Searching...
No Matches
safeLogRatio.cxx File Reference
#include "TrigBjetHypo/safeLogRatio.h"
#include <cmath>
#include <limits>
Include dependency graph for safeLogRatio.cxx:

Go to the source code of this file.

Functions

float safeLogRatio (float num, float denom)

Function Documentation

◆ safeLogRatio()

float safeLogRatio ( float num,
float denom )

Definition at line 10 of file safeLogRatio.cxx.

10 {
11 // ep(silon) is the smallest non-subnormal number
12 // the recyprocal of this should not overflow
13 float ep = std::numeric_limits<float>::min();
14 float ratio = (std::abs(denom) < ep ? INFINITY : num / denom);
15 return std::abs(ratio) < ep ? -INFINITY : std::log( ratio );
16}