Commit 4dd3a28f authored by yanzg's avatar yanzg

表结构修改

parent f59759fc
......@@ -60,8 +60,8 @@ public class CalcHelper {
*/
public static double addListDouble(Double d1, Double... d2) {
double ret = d1;
for (double item : d2) {
ret = add(ret, item);
for (Double item : d2) {
ret = addDouble(ret, item);
}
return ret;
}
......@@ -114,8 +114,8 @@ public class CalcHelper {
*/
public static double subListDouble(Double d1, Double... d2) {
double ret = d1;
for (double item : d2) {
ret = sub(ret, item);
for (Double item : d2) {
ret = subDouble(ret, item);
}
return ret;
}
......@@ -168,8 +168,8 @@ public class CalcHelper {
*/
public static double mulListDouble(Double d1, Double... d2) {
double ret = d1;
for (double item : d2) {
ret = mul(ret, item);
for (Double item : d2) {
ret = mulDouble(ret, item);
}
return ret;
}
......@@ -249,8 +249,8 @@ public class CalcHelper {
*/
public static double divListDouble(Double d1, Double... d2) {
double ret = d1;
for (double item : d2) {
ret = div(ret, item);
for (Double item : d2) {
ret = divDouble(ret, item);
}
return ret;
}
......
package helper;
import com.yanzuoguang.util.helper.CalcHelper;
import com.yanzuoguang.util.helper.RsaHelper;
import org.junit.Assert;
import org.junit.Test;
......@@ -18,4 +17,26 @@ public class TestCalc {
double d4 = d1 + d2;
Assert.assertFalse(CalcHelper.equals(d4, 0.3));
}
@Test
public void test1() throws Exception {
double d1 = 0.1;
double d2 = 0.2;
double d3 = CalcHelper.addListDouble(d1, d2, null);
Assert.assertTrue(CalcHelper.equals(d3, 0.3));
CalcHelper.subListDouble(d1, d2, null);
CalcHelper.mulListDouble(d1, d2, null);
CalcHelper.divListDouble(d1, d2, 0.5);
CalcHelper.addList(d1, d2, 0.3);
CalcHelper.subList(d1, d2, 0.3);
CalcHelper.mulList(d1, d2, 0.5);
CalcHelper.divList(d1, d2, 0.5);
double d4 = d1 + d2;
Assert.assertFalse(CalcHelper.equals(d4, 0.3));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment