Std::numeric_limits<double> vs sys.float_info?

Hi, I’m using TCut objects in PyROOT to restrict values below a threshold T. I wish to temporarily disable the cut without having to change a bunch of code.

Normally in C++ I would set the threshold T to std::numeric_limits::max() so that any valid double passes the cut. On my computer this is 1.797693e+308.

In Python, I can get the system max float from sys.float_info.max. On my computer this is consistent with what C++ says: 1.7976931348623157e+308

My question is, can I reasonably assume that these two will always be equal on a given platform? The values on which I am cutting are produced using compiled C++/ROOT code, but I am doing the TCut in Python. I am worried that if I try to switch off my laptop to a cluster, possibly some valid C++ floats will be above the python sys.float_info.max value for some reason.

Thanks for your advice. A simple “yes they are always the same” would be enough to comfort me.

Both cases return the “DBL_MAX” macro defined in compiler’s “float.h”, so “binary representations” should be equal.