[CLN-list] cl_inhibit_floating_point_underflow

Kåre Olaussen Kare.Olaussen at ntnu.no
Mon Oct 3 00:42:51 CEST 2011


> Apart from that: Did you #include <cln/float.h>? Where is that assignment (as you write it it could be outside a function body)?

As I said I tried several things. My experience is that if one includes <cln/cln.h> all
the rest  is automatically included. I have never registered any difference with explicit inclusion
on various linux and MacOS distributions.

Here is a minimal demonstration

/* File: demo.cc
   Compilation: g++ -g -O2 -o demo demo.cc -lcln
 */

//bool cln::cl_inhibit_floating_point_underflow = true;

#include <cln/cln.h>
#include <cln/float.h>

//using namespace std;
using namespace cln;

//bool cln::cl_inhibit_floating_point_underflow = true;
bool cl_inhibit_floating_point_underflow = true;

int main()
{
  float_format_t precision = float_format(50);
  cl_F x =  least_positive_float(precision);
  while(x > cl_float(0, precision) ) {
    std::cout << x << std::endl;
    x *= x;
  }
}

which produces the output:

> 7.241484622111747243360392473658128214691955086151413286838L-2776511644261678567
> terminate called after throwing an instance of 'cln::floating_point_underflow_exception'
>   what():  floating point underflow.
> Abort trap
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cebix.net/pipermail/cln-list/attachments/20111003/ee891863/attachment.html>


More information about the CLN-list mailing list