[CLN-list] cl_inhibit_floating_point_underflow

Michael Miller millermj at lemoyne.edu
Mon Oct 3 00:40:28 CEST 2011


Try moving the line

    bool cl_inhibit_floating_point_underflow = true;

inside the function main, without the bool, so the first three lines 
look like:

int main()
{
   cl_inhibit_floating_point_underflow = true;


On 10/02/2011 06:42 PM, Kåre Olaussen wrote:
> Here is a minimal demonstration
>
> /* File: demo.cc
> Compilation: g++ -g -O2 -o demo demo.cc -lcln
> */
>
> #include <cln/cln.h>
> #include <cln/float.h>
>
> using namespace cln;
>
> 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


More information about the CLN-list mailing list