From d6650e66f09443bb8187b8d2d0ecb52d2e59b5f3 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Fri, 11 Nov 2022 13:21:21 +0100 Subject: [PATCH] To find the nearest integer, use nearbyint(). trunc() has delivered only one-sided answers. --- src/spicelib/parser/ptfuncs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spicelib/parser/ptfuncs.c b/src/spicelib/parser/ptfuncs.c index c084350d8..8f1dc3760 100644 --- a/src/spicelib/parser/ptfuncs.c +++ b/src/spicelib/parser/ptfuncs.c @@ -78,7 +78,7 @@ PTpower(double arg1, double arg2) /* If arg2 is quasi an integer, round it to have pow not fail when arg1 is negative. Takes into account the double representation which sometimes differs in the last digit(s). */ - if (AlmostEqualUlps(trunc(arg2), arg2, 10)) + if (AlmostEqualUlps(nearbyint(arg2), arg2, 10)) res = pow(arg1, round(arg2)); else /* As per LTSPICE specification for ** */