Skip to content

Commit

Permalink
Merge pull request #99 from niyaznigmatullin/double_compare
Browse files Browse the repository at this point in the history
Add `abs` call to double comparison
  • Loading branch information
AbdullinAM authored Dec 7, 2023
2 parents 464a27f + 5484852 commit dbaf0e3
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ import kotlin.math.abs
object ConstantPropagator : Transformer<ConstantPropagator>, IncrementalTransformer {
private const val epsilon = 1e-5

infix fun Double.eq(other: Double) = (this - other) < epsilon
infix fun Double.neq(other: Double) = (this - other) >= epsilon
infix fun Float.eq(other: Float) = (this - other) < epsilon
infix fun Float.neq(other: Float) = (this - other) >= epsilon
infix fun Double.eq(other: Double) = abs(this - other) < epsilon
infix fun Double.neq(other: Double) = abs(this - other) >= epsilon
infix fun Float.eq(other: Float) = abs(this - other) < epsilon
infix fun Float.neq(other: Float) = abs(this - other) >= epsilon

override fun apply(state: IncrementalPredicateState): IncrementalPredicateState {
return IncrementalPredicateState(
Expand Down

0 comments on commit dbaf0e3

Please sign in to comment.