summaryrefslogtreecommitdiff
path: root/src/piraha/Call.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/piraha/Call.cc')
-rw-r--r--src/piraha/Call.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/piraha/Call.cc b/src/piraha/Call.cc
index f4bfefe7..1f6969e8 100644
--- a/src/piraha/Call.cc
+++ b/src/piraha/Call.cc
@@ -542,7 +542,9 @@ smart_ptr<Value> meval(smart_ptr<Group> gr) {
if(ret->type == PIR_INT) {
ret->idata = -ret->idata;
} else if(ret->type == PIR_REAL) {
- ret->ddata = -ret->ddata;
+ ret->ddata = std::copysign(ret->ddata,
+ std::signbit(ret->ddata) ?
+ 1. : -1.);
} else {
std::ostringstream msg;
msg << "Unknown operation: " << unop << ret->type << std::endl;