Skip to content

Commit 3824f29

Browse files
committed
Java's frem bytecode does fmod()
The frem bytecode instruction performs an operation similar to fmod(), and is not IEEE floating-point remainder.
1 parent a038d0c commit 3824f29

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

jbmc/src/java_bytecode/java_bytecode_convert_method.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1558,8 +1558,10 @@ java_bytecode_convert_methodt::convert_instructions(const methodt &method)
15581558
else if(bytecode == patternt("?rem"))
15591559
{
15601560
PRECONDITION(op.size() == 2 && results.size() == 1);
1561+
// This is _not_ the remainder operation defined by IEEE 754,
1562+
// but similar to the fmod C library function.
15611563
if(bytecode == BC_frem || bytecode == BC_drem)
1562-
results[0]=rem_exprt(op[0], op[1]);
1564+
results[0] = binary_exprt(op[0], ID_floatbv_mod, op[1]);
15631565
else
15641566
results[0]=mod_exprt(op[0], op[1]);
15651567
}

0 commit comments

Comments
 (0)