Khan/khan-exercises

Merge pull request #43528 from petercollingridge/non-neg-denom

```No longer accept answers with a negative denominator

fix #43485; and keep Alpert happy.

Test plan: Test exercises http://localhost:8000/exercises/simplifying_rational_expressions_2.html and make sure it still accepts the correct answer whilst rejecting answers with negated denominator and numerator.

Auditors: alpert```
2 parents f761fc4 + 77426f4 commit 086ffe66935301bd857a07d9f5461a3d62e1983a petercollingridge committed Mar 19, 2013
Showing with 12 additions and 10 deletions.
1. +12 −10 exercises/simplifying_rational_expressions_2.html
22 exercises/simplifying_rational_expressions_2.html
 @@ -98,10 +98,16 @@ expr(["+", ["*", COEFFICIENT2, X], CONSTANT2]) expr(["+", ["*", -COEFFICIENT1, X], -CONSTANT1]) expr(["+", ["*", -COEFFICIENT2, X], -CONSTANT2]) - getExpressionRegex(COEFFICIENT1, X, CONSTANT1) - getExpressionRegex(COEFFICIENT2, X, CONSTANT2) - getExpressionRegex(-COEFFICIENT1, X, -CONSTANT1) - getExpressionRegex(-COEFFICIENT2, X, -CONSTANT2) + (function() { + if (COEFFICIENT2 < 0 || (COEFFICIENT2 === 0 && CONSTANT1 < 0)) { + return [getExpressionRegex(-COEFFICIENT1, X, -CONSTANT1), + getExpressionRegex(-COEFFICIENT2, X, -CONSTANT2)]; + } else { + return [getExpressionRegex(COEFFICIENT1, X, CONSTANT1), + getExpressionRegex(COEFFICIENT2, X, CONSTANT2)]; + } + })() +

Simplify the following expression:

@@ -110,12 +116,8 @@
- POSITIVENUMERATOR - POSITIVEDENOMINATOR -
-
- NEGATIVENUMERATOR - NEGATIVEDENOMINATOR + REGEX[0] + REGEX[1]