Skip to content

Commit

Permalink
Update value.c
Browse files Browse the repository at this point in the history
removed.boolean switch
  • Loading branch information
swilly22 committed May 11, 2020
1 parent ecab729 commit e5ab233
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/value.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,10 @@ SIValue SIValue_Divide(const SIValue a, const SIValue b) {
// Calculate a mod n for integer and floating-point inputs.
SIValue SIValue_Modulo(const SIValue a, const SIValue n) {
bool inputs_are_integers = SI_TYPE(a) & SI_TYPE(n) & T_INT64;
switch(inputs_are_integers) {
case true:
if(inputs_are_integers) {
// The modulo machine instruction may be used if a and n are both integers.
return SI_LongVal(a.longval % n.longval);
default:
} else {
// Otherwise, use the library function fmod to calculate the modulo and return a double.
return SI_DoubleVal(fmod(SI_GET_NUMERIC(a), SI_GET_NUMERIC(n)));
}
Expand Down

0 comments on commit e5ab233

Please sign in to comment.