Revive the project

This commit is contained in:
Sergey Solovyev
2023-09-15 10:08:16 +02:00
parent 22448df392
commit 1fc9ffef3a
481 changed files with 3061 additions and 3414 deletions

View File

@@ -450,7 +450,7 @@ public final class NumericWrapper extends Generic implements INumeric<NumericWra
void bodyToMathML(MathML element) {
MathML e1 = element.element("mn");
e1.appendChild(element.text(String.valueOf(new Double(((Real) content).doubleValue()))));
e1.appendChild(element.text(String.valueOf(Double.valueOf(((Real) content).doubleValue()))));
element.appendChild(e1);
}

View File

@@ -223,7 +223,7 @@ public class Monomial implements Comparable {
for (int i = 0; i < unknown.length; i++) {
int c = element(i);
if (c > 0) {
unknown[i].toMathML(element, new Integer(c));
unknown[i].toMathML(element, Integer.valueOf(c));
}
}
}

View File

@@ -79,7 +79,7 @@ public class MutableInt extends Number implements Comparable {
* @return the value as a Integer
*/
public Object getValue() {
return new Integer(this.value);
return Integer.valueOf(this.value);
}
/**
@@ -213,7 +213,7 @@ public class MutableInt extends Number implements Comparable {
* @return a Integer instance containing the value from this mutable
*/
public Integer toInteger() {
return new Integer(intValue());
return Integer.valueOf(intValue());
}
//-----------------------------------------------------------------------

View File

@@ -10,6 +10,7 @@ import static midpcalc.Real.NumberFormat.FSE_SCI;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import javax.annotation.Nonnull;
import midpcalc.Real;
@@ -77,7 +78,7 @@ public class NumberFormatter {
if (simpleFormat) {
precision += 1;
final int newScale = Math.max(1, (int) (precision * Math.max(1, radix / 10f)) - 1);
value = BigDecimal.valueOf(value).setScale(newScale, BigDecimal.ROUND_HALF_UP).doubleValue();
value = BigDecimal.valueOf(value).setScale(newScale, RoundingMode.HALF_UP).doubleValue();
absValue = Math.abs(value);
}
if (simpleFormat) {

View File

@@ -118,7 +118,7 @@ public abstract class AbstractMessage implements Message {
*/
@Nonnull
public String getLocalizedMessage(@Nonnull Locale locale) {
return makeMessage(locale, getMessagePattern(locale), parameters, messageLevel);
return makeMessage(locale, getMessagePattern(locale).replace("'", "''"), parameters, messageLevel);
}
@Nonnull

View File

@@ -680,7 +680,7 @@ public class ExpressionTest {
private void testSinEqualsToSinh(@Nonnull MathEngine mathEngine, @Nonnull Double x, @Nullable String expected) throws ParseException {
if (expected == null) {
assertEquals(mathEngine.evaluate("sinh(i*" + x + ")/i"), mathEngine.evaluate("sin(" + x + ")"));
assertEquals(mathEngine.simplify(mathEngine.evaluate("sinh(i*" + x + ")/i")), mathEngine.evaluate("sin(" + x + ")"));
// Assert.assertEquals(mathEngine.evaluate("exp("+x+")-sinh(" + x + ")"), mathEngine.evaluate("cosh(" + x + ")"));
} else {
assertEquals(expected, mathEngine.evaluate("sin(" + x + ")"));

View File

@@ -129,7 +129,7 @@ public class NumberFormatterTest {
assertEquals("5000000000000000000", numberFormatter.format(5000000000000000001d));
assertEquals("5000000000000000001", numberFormatter.format(BigInteger.valueOf(5000000000000000001L)));
assertEquals("5999999999999994900", numberFormatter.format(5999999999999994999d));
assertEquals("5999999999999995000", numberFormatter.format(5999999999999994999d));
assertEquals("5999999999999994999", numberFormatter.format(BigInteger.valueOf(5999999999999994999L)));
assertEquals("5E19", numberFormatter.format(50000000000000000000d));
@@ -202,4 +202,4 @@ public class NumberFormatterTest {
private static double makeDouble(int integerPart, int fractionalPart) {
return Double.parseDouble(integerPart + "." + fractionalPart);
}
}
}