From 581a8e26f1c014a097ab4934cdc283fb7dfc7ea1 Mon Sep 17 00:00:00 2001 From: Jeff Wang Date: Mon, 21 Oct 2019 02:31:18 -0400 Subject: [PATCH] disallow subtraction/negation of error --- src/decn/decn.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/decn/decn.c b/src/decn/decn.c index 9917d5a..f994dea 100644 --- a/src/decn/decn.c +++ b/src/decn/decn.c @@ -406,6 +406,9 @@ void negate_decn(dec80* x){ #else static const exp_t xor_val = -(0x7f) - 1; #endif + if (decn_is_nan(x)){ + return; + } (x->exponent) ^= xor_val; }