Skip to content

Commit

Permalink
Replace nearbyint with roundl in CL
Browse files Browse the repository at this point in the history
Originally, CL used FORTRANs NINT function which always rounds up for
.5, while nearbyint rounds towards the even number in this case.
  • Loading branch information
olebole committed Jan 17, 2024
1 parent bebbccb commit 844c79f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/cl/unop.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ unop (int opcode)
break;
case OP_NINT:
if (in_type == OT_REAL)
iresult = nearbyint (rval);
iresult = roundl (rval);
else
iresult = ival;
break;
Expand Down
2 changes: 1 addition & 1 deletion pkg/ecl/unop.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ unop (int opcode)
break;
case OP_NINT:
if (in_type == OT_REAL)
iresult = nearbyint (rval);
iresult = roundl (rval);
else
iresult = ival;
break;
Expand Down

0 comments on commit 844c79f

Please sign in to comment.