Skip to content

Commit

Permalink
Solve modulus operation problem with double (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyerinshelly committed Feb 26, 2024
1 parent 5cdc560 commit 21916b2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/main/scala/fhetest/Phase/Interp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,10 @@ case object Interp {
case _ => throw new Error(s"[Error] numOp: Wrong operand type")
}
result match {
case T2Int(v) => T2Int(v % modulus)
case T2Double(v) => T2Double(v % modulus)
case T2EncInt(v) => T2EncInt(v.map(i => i % modulus))
case T2EncDouble(v) => T2EncDouble(v.map(i => i % modulus))
case _ => throw new Error(s"[Error] numOp: Unreachable")
case T2Int(v) => T2Int(v % modulus)
case T2EncInt(v) => T2EncInt(v.map(i => i % modulus))
case T2Double(_) | T2EncDouble(_) => result
case _ => throw new Error(s"[Error] numOp: Unreachable")
}
}

Expand Down

0 comments on commit 21916b2

Please sign in to comment.