#114 Floating point underflow exception

open
nobody
5
2010-03-06
2010-03-06
jpa
No

When executing this calculation on version 0.9.7, the program crashes with cln::floating_point_underflow_exception.
exp(-1.1eV/(boltzmann*300K))

Seems somewhat related to bug 1630097, but in this case the value inside exp() is just -42.5. It also works if the calculation is done in two phases.
https://sourceforge.net/tracker/index.php?func=detail&aid=1971494&group_id=86696&atid=580546

Backtrace follows:
terminate called after throwing an instance of 'cln::floating_point_underflow_exception'
what(): floating point underflow.

Program received signal SIGABRT, Aborted.
[Switching to Thread 0xb6a62b90 (LWP 22223)]
0xffffe424 in ?? ()
(gdb) bt
#0 0xffffe424 in ?? ()
#1 0xb7657a85 in *__GI_abort () at abort.c:88
#2 0xb7886a8f in __gnu_cxx::__verbose_terminate_handler() ()
from /usr/lib/libstdc++.so.6
#3 0xb78849c5 in ?? () from /usr/lib/libstdc++.so.6
#4 0xb7884a02 in std::terminate() () from /usr/lib/libstdc++.so.6
#5 0xb7884b41 in __cxa_throw () from /usr/lib/libstdc++.so.6
#6 0xb7995eba in cln::scale_float(cln::cl_LF const&, cln::cl_I const&) ()
from /usr/lib/libcln.so.5
#7 0xb790dcd6 in cln::scale_float(cln::cl_F const&, cln::cl_I const&) ()
from /usr/lib/libcln.so.5
#8 0xb7923046 in cln::exp(cln::cl_F const&) () from /usr/lib/libcln.so.5
#9 0xb79f777d in cln::exp(cln::cl_R const&) () from /usr/lib/libcln.so.5
#10 0xb78fb08e in cln::exp(cln::cl_N const&) () from /usr/lib/libcln.so.5
#11 0xb78fb342 in cln::expt(cln::cl_N const&, cln::cl_N const&) ()
from /usr/lib/libcln.so.5
#12 0xb7c17624 in Number::raise (this=0xb6a613dc, o=..., try_exact=false)
at Number.cc:1453
#13 0xb7c73b78 in MathStructure::merge_power (this=0x80e2ae0, mstruct=...,
eo=..., mparent=0xb6a6165c, index_this=0, index_mstruct=1)
at MathStructure.cc:2924
#14 0xb7c77461 in MathStructure::calculateRaiseExponent (this=0xb6a6165c,
eo=..., mparent=0x0, index_this=1) at MathStructure.cc:5151

Discussion

  • I can reproduce. Should be fixed.

     
  • Ansgar666
    Ansgar666
    2011-02-17

    If the sign is changed to positive i.e. ("exp(32*meV/(boltzmann*78K))") qalc crashes with a cln::floating_point_overflow_exception.

    terminate called after throwing an instance of 'cln::floating_point_overflow_exception'
    what(): floating point overflow.

    Program received signal SIGABRT, Aborted.
    [Switching to Thread 0x7ffff3e4b700 (LWP 17313)]
    0x00007ffff5b6fba5 in raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
    64 ../nptl/sysdeps/unix/sysv/linux/raise.c: Datei oder Verzeichnis nicht gefunden.
    in ../nptl/sysdeps/unix/sysv/linux/raise.c
    (gdb) bt
    #0 0x00007ffff5b6fba5 in raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
    #1 0x00007ffff5b736b0 in abort () at abort.c:92
    #2 0x00007ffff64136bd in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/libstdc++.so.6
    #3 0x00007ffff6411906 in ?? () from /usr/lib/libstdc++.so.6
    #4 0x00007ffff6411933 in std::terminate() () from /usr/lib/libstdc++.so.6
    #5 0x00007ffff6411a3e in __cxa_throw () from /usr/lib/libstdc++.so.6
    #6 0x00007ffff66c315d in cln::scale_float(cln::cl_LF const&, cln::cl_I const&) () from /usr/lib/libcln.so.6
    #7 0x00007ffff66b4fc8 in cln::scale_float(cln::cl_F const&, cln::cl_I const&) () from /usr/lib/libcln.so.6
    #8 0x00007ffff66dcaba in cln::exp(cln::cl_F const&) () from /usr/lib/libcln.so.6
    #9 0x00007ffff679d364 in cln::exp(cln::cl_R const&) () from /usr/lib/libcln.so.6
    #10 0x00007ffff66a09b0 in cln::exp(cln::cl_N const&) () from /usr/lib/libcln.so.6
    #11 0x00007ffff66a0cc9 in cln::expt(cln::cl_N const&, cln::cl_N const&) () from /usr/lib/libcln.so.6
    #12 0x00007ffff6dee049 in Number::raise(Number const&, bool) () from /usr/lib/libqalculate.so.5
    #13 0x00007ffff6e3cbce in MathStructure::merge_power(MathStructure&, EvaluationOptions const&, MathStructure*, unsigned long, unsigned long, bool) () from /usr/lib/libqalculate.so.5
    #14 0x00007ffff6e3fd7b in MathStructure::calculateRaiseExponent(EvaluationOptions const&, MathStructure*, unsigned long) () from /usr/lib/libqalculate.so.5
    #15 0x00007ffff6e3db05 in MathStructure::merge_power(MathStructure&, EvaluationOptions const&, MathStructure*, unsigned long, unsigned long, bool) () from /usr/lib/libqalculate.so.5
    #16 0x00007ffff6e35867 in MathStructure::calculatesub(EvaluationOptions const&, EvaluationOptions const&, bool, MathStructure*, unsigned long) () from /usr/lib/libqalculate.so.5
    #17 0x00007ffff6e29624 in MathStructure::eval(EvaluationOptions const&) () from /usr/lib/libqalculate.so.5
    #18 0x00007ffff6db0755 in Calculator::calculate(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, EvaluationOptions const&, MathStructure*, MathStructure*, bool) ()
    from /usr/lib/libqalculate.so.5
    #19 0x00007ffff6db1203 in calculate_proc(void*) () from /usr/lib/libqalculate.so.5
    #20 0x00007ffff69e6971 in start_thread (arg=<value optimized out>) at pthread_create.c:304
    #21 0x00007ffff5c2292d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
    #22 0x0000000000000000 in ?? ()