/** * Compute a compound state representing possible results of adding the given summand compound * states up. This method provides a much weaker implementation of compound state addition than * {@link CompoundInterval#add(CompoundInterval)} and will thus usually return a much larger * result range. * * @param a the first summand. * @param b the second summand. * @return a state representing possible results of adding the given summand compound states up. */ private CompoundInterval weakAdd(CompoundInterval pA, CompoundInterval pB) { if (pA.isSingleton() && pA.containsZero()) { return pB; } if (pB.isSingleton() && pB.containsZero()) { return pA; } return abstractionOf(pA.add(pB)); }
/** * Compute a compound state representing possible results of multiplying the given factor compound * states. This method provides a much weaker implementation of compound state addition than * {@link CompoundInterval#multiply(CompoundInterval)} and will thus usually return a much larger * result range. * * @param a the first factor. * @param b the second factor. * @return a state representing possible results of multiplying the given factor compound states. */ private CompoundInterval weakMultiply(CompoundInterval a, CompoundInterval b) { if (a.isSingleton() && a.containsZero()) { return a; } if (b.isSingleton() && b.containsZero()) { return b; } if (a.isSingleton() && a.contains(1)) { return b; } if (b.isSingleton() && b.contains(1)) { return a; } return abstractionOf(a.multiply(b)); }