mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 17:51:13 +08:00
fixed according to pull request review
This commit is contained in:
parent
ccd8088f93
commit
89e9cb86e2
1 changed files with 12 additions and 14 deletions
26
vendor/assets/javascripts/ruleJS.js
vendored
26
vendor/assets/javascripts/ruleJS.js
vendored
|
@ -1038,10 +1038,10 @@ var ruleJS = (function (root) {
|
|||
//(sci-2587) MODIFICATION TO AVOID JAVASCRIPT IEEE MANTISSA&EXPONENT FLOATS INNACURACY
|
||||
try{
|
||||
var number1_big = new Big(number1);
|
||||
var result_big = number1_big.plus(number2)
|
||||
result = parseFloat(result_big)
|
||||
var result_big = number1_big.plus(number2);
|
||||
result = parseFloat(result_big);
|
||||
} catch(e) {
|
||||
result = number1 + number2
|
||||
result = number1 + number2;
|
||||
}
|
||||
//MODIFICATION END
|
||||
|
||||
|
@ -1051,24 +1051,23 @@ var ruleJS = (function (root) {
|
|||
//(sci-2587) MODIFICATION TO AVOID JAVASCRIPT IEEE MANTISSA&EXPONENT FLOATS INNACURACY
|
||||
try{
|
||||
var number1_big = new Big(number1);
|
||||
var result_big = number1_big.minus(number2)
|
||||
result = parseFloat(result_big)
|
||||
var result_big = number1_big.minus(number2);
|
||||
result = parseFloat(result_big);
|
||||
} catch(e) {
|
||||
result = number1 - number2
|
||||
result = number1 - number2;
|
||||
}
|
||||
//MODIFICATION END
|
||||
|
||||
//ORIGINAL: result = number1 - number2;
|
||||
break;
|
||||
case '/':
|
||||
|
||||
//(sci-2587) MODIFICATION TO AVOID JAVASCRIPT IEEE MANTISSA&EXPONENT FLOATS INNACURACY
|
||||
try{
|
||||
var number1_big = new Big(number1);
|
||||
var result_big = number1_big.div(number2)
|
||||
result = parseFloat(result_big)
|
||||
var result_big = number1_big.div(number2);
|
||||
result = parseFloat(result_big);
|
||||
} catch(e){
|
||||
result = number1 / number2
|
||||
result = number1 / number2;
|
||||
}
|
||||
//MODIFICATION END
|
||||
|
||||
|
@ -1081,14 +1080,13 @@ var ruleJS = (function (root) {
|
|||
}
|
||||
break;
|
||||
case '*':
|
||||
|
||||
//(sci-2587) MODIFICATION TO AVOID JAVASCRIPT IEEE MANTISSA&EXPONENT FLOATS INNACURACY
|
||||
try{
|
||||
var number1_big = new Big(number1);
|
||||
var result_big = number1_big.times(number2)
|
||||
result = parseFloat(result_big)
|
||||
var result_big = number1_big.times(number2);
|
||||
result = parseFloat(result_big);
|
||||
} catch(e) {
|
||||
result = number1 * number2
|
||||
result = number1 * number2;
|
||||
}
|
||||
//MODIFICATION END
|
||||
|
||||
|
|
Loading…
Reference in a new issue