piraha parses "-0." incorrectly

Create issue
Issue #1650 closed
Roland Haas created an issue

When encountering

foo::bar = -0.

in parameter files, the piraha parser returns (double)0. instead of (double)-0. it is misses the signed zero that the floating point numbers provide.

This makes it impossible to recover from (older) checkpoints where eg coordbase::xmin is given as -0.

A possible fix is to change line 545 of Call.cc from

ret->ddata = -ret->ddata;

to

ret->ddata = std::copysign(ret->ddata, std::signbit(ret->ddata) ? 1. : -1.);

Keyword:

Comments (4)

  1. Log in to comment