本文整理汇总了Java中java.math.MathContext类的典型用法代码示例。如果您正苦于以下问题:Java MathContext类的具体用法?Java MathContext怎么用?Java MathContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MathContext类属于java.math包,在下文中一共展示了MathContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testItem_0523
import java.math.MathContext; //导入依赖的package包/类
public void testItem_0523()
{
boolean caught;
caught = false;
try {
rc_BigDecimal = new BigDecimal("UBI84SBSU744YNY9HCHKAUJSRYFATK13OIHLG9B4NLV", new MathContext("precision=0 roundingMode=HALF_EVEN"));
}
catch (java.lang.NumberFormatException e) {
caught = true;
}
Assert.assertEquals("91.61073825503355%", true, caught);
}
示例2: testItem_0717
import java.math.MathContext; //导入依赖的package包/类
public void testItem_0717()
{
boolean caught;
caught = false;
try {
rc_MathContext = new MathContext(-1);
}
catch (java.lang.IllegalArgumentException e) {
caught = true;
}
Assert.assertEquals("91.94630872483222%", true, caught);
}
示例3: testItem_0641
import java.math.MathContext; //导入依赖的package包/类
public void testItem_0641()
{
boolean caught;
caught = false;
try {
rc_MathContext = new MathContext(-2147483648);
}
catch (java.lang.IllegalArgumentException e) {
caught = true;
}
Assert.assertEquals("85.57046979865771%", true, caught);
}
示例4: testItem_0361
import java.math.MathContext; //导入依赖的package包/类
public void testItem_0361()
{
boolean caught;
caught = false;
try {
rc_BigDecimal = new BigDecimal("", new MathContext("precision=1 roundingMode=HALF_UP"));
}
catch (java.lang.NumberFormatException e) {
caught = true;
}
Assert.assertEquals("91.61073825503355%", true, caught);
}
示例5: testItem_0903
import java.math.MathContext; //导入依赖的package包/类
public void testItem_0903()
{
boolean caught;
caught = false;
try {
rc_BigDecimal = new BigDecimal(new char[]{'\1'}, new MathContext("precision=0 roundingMode=HALF_UP"));
}
catch (java.lang.NumberFormatException e) {
caught = true;
}
Assert.assertEquals("91.94630872483222%", true, caught);
}
示例6: testItem_0574
import java.math.MathContext; //导入依赖的package包/类
public void testItem_0574()
{
boolean caught;
caught = false;
try {
rc_BigDecimal = new BigDecimal(new char[]{'\234', '\1', '8', '\234', '\234', '\234', '\234', '8', '\1', '\1', '\0', '\uFFFF', '8', '\0', '\234', '\1', '\1', '\234', '\234', '\0', '\1', '\uFFFF', '\uFFFF', '\234', '8', '\uFFFF', '8', '\uFFFF', '\uFFFF', '\234', '\0', '\0', '\234', '\1', '\234', '\0', '\0', '\234', '\1', '8', '\0', '\1', '8', '\234', '\uFFFF', '\234', '8', '\0', '\1', '\234', '\0', '\0', '\0', '8', '8', '\1', '\234', '\0', '\uFFFF', '\234', '\0', '\1', '\1', '\234', '\1', '\0', '\uFFFF', '\uFFFF'}, new MathContext("precision=1 roundingMode=CEILING"));
}
catch (java.lang.NumberFormatException e) {
caught = true;
}
Assert.assertEquals("91.94630872483222%", true, caught);
}
示例7: testItem_0952
import java.math.MathContext; //导入依赖的package包/类
public void testItem_0952()
{
boolean caught;
caught = false;
try {
rc_BigDecimal_array = (new BigDecimal("-10")).divideAndRemainder(new BigDecimal("0"), new MathContext("precision=0 roundingMode=HALF_EVEN"));
}
catch (java.lang.ArithmeticException e) {
caught = true;
}
Assert.assertEquals("91.94630872483222%", true, caught);
}
示例8: testItem_0034
import java.math.MathContext; //导入依赖的package包/类
public void testItem_0034()
{
boolean caught;
caught = false;
try {
rc_MathContext = new MathContext(-1, java.math.RoundingMode.HALF_DOWN);
}
catch (java.lang.IllegalArgumentException e) {
caught = true;
}
Assert.assertEquals("91.94630872483222%", true, caught);
}
示例9: testItem_0541
import java.math.MathContext; //导入依赖的package包/类
public void testItem_0541()
{
boolean caught;
caught = false;
try {
rc_BigDecimal = new BigDecimal("N30=9D3=CYSF", new MathContext("precision=2147483647 roundingMode=HALF_UP"));
}
catch (java.lang.NumberFormatException e) {
caught = true;
}
Assert.assertEquals("91.94630872483222%", true, caught);
}
示例10: testItem_0595
import java.math.MathContext; //导入依赖的package包/类
public void testItem_0595()
{
boolean caught;
caught = false;
try {
rc_BigDecimal = (new BigDecimal("-0.1")).remainder(new BigDecimal("0"), new MathContext("precision=2147483647 roundingMode=HALF_UP"));
}
catch (java.lang.ArithmeticException e) {
caught = true;
}
Assert.assertEquals("91.94630872483222%", true, caught);
}
示例11: testItem_0415
import java.math.MathContext; //导入依赖的package包/类
public void testItem_0415()
{
boolean caught;
caught = false;
try {
rc_BigDecimal = new BigDecimal(new char[]{'\234', '\234', '\1', '\234', '\1', '\234', '\uFFFF', '\234', '\234', '\uFFFF', '8', '\234', '\234', '\0', '\1', '8', '8', '\0', '\0', '\0', '\0', '\1', '\0', '\0', '\uFFFF', '\uFFFF', '\234', '\0', '\0', '8', '8', '8', '8', '\0', '\uFFFF', '8', '8', '\0', '8', '8', '\0', '\uFFFF', '\0', '\uFFFF', '8', '\234', '\uFFFF', '\234', '\0', '\234', '\uFFFF', '\0', '8', '8'}, new MathContext("precision=2147483647 roundingMode=HALF_UP"));
}
catch (java.lang.NumberFormatException e) {
caught = true;
}
Assert.assertEquals("91.94630872483222%", true, caught);
}
示例12: testItem_0092
import java.math.MathContext; //导入依赖的package包/类
public void testItem_0092()
{
boolean caught;
caught = false;
try {
rc_BigDecimal = (new BigDecimal("2E+9")).pow(-2147483648, new MathContext("precision=2147483647 roundingMode=HALF_DOWN"));
}
catch (java.lang.ArithmeticException e) {
caught = true;
}
Assert.assertEquals("91.94630872483222%", true, caught);
}
示例13: testItem_0394
import java.math.MathContext; //导入依赖的package包/类
public void testItem_0394()
{
boolean caught;
caught = false;
try {
rc_BigDecimal = new BigDecimal(new char[]{'\0', '\uFFFF', '\234', '\uFFFF', '\1', '\234', '\234', '8', '\uFFFF', '\uFFFF', '\1', '\uFFFF', '\0', '\234', '\0', '\234', '\234', '\uFFFF', '\234', '\uFFFF', '8', '\234', '8', '\1', '\234', '8', '\1', '\0', '\234', '\uFFFF', '8', '\uFFFF', '\0', '\1', '\0', '\uFFFF', '8', '\0', '\uFFFF', '\uFFFF', '\234', '\uFFFF', '8', '\1', '\234', '\uFFFF', '8', '\uFFFF', '\234', '\0', '8', '\uFFFF', '8', '\234', '\0', '\0', '8', '8', '\1', '8', '\234', '\uFFFF', '8', '\1', '\1', '\1', '\uFFFF', '\1', '\1', '8', '8', '8', '\0', '\234', '\1', '\uFFFF', '\1', '\1', '\1', '\234', '\0', '8', '\1', '\1', '\0', '8', '\uFFFF', '\234', '\1', '\uFFFF', '\uFFFF', '\uFFFF', '\1', '8', '\1', '\0', '\uFFFF', '\234', '\0', '\0'}, new MathContext("precision=0 roundingMode=FLOOR"));
}
catch (java.lang.NumberFormatException e) {
caught = true;
}
Assert.assertEquals("90.93959731543625%", true, caught);
}
示例14: testItem_0418
import java.math.MathContext; //导入依赖的package包/类
public void testItem_0418()
{
boolean caught;
caught = false;
try {
rc_MathContext = new MathContext(-2147483648, java.math.RoundingMode.CEILING);
}
catch (java.lang.IllegalArgumentException e) {
caught = true;
}
Assert.assertEquals("89.93288590604027%", true, caught);
}
示例15: testItem_0077
import java.math.MathContext; //导入依赖的package包/类
public void testItem_0077()
{
boolean caught;
caught = false;
try {
rc_BigDecimal = new BigDecimal(new char[]{'8', '\uFFFF', '\0', '8', '\0', '\uFFFF', '\1', '\uFFFF', '\uFFFF', '\1', '\234', '\234', '\1', '\0', '\1', '\1', '8', '\234', '\1', '\uFFFF', '\0', '\uFFFF', '\0', '\234', '\uFFFF', '\0', '\0', '\1', '\234', '8', '\1', '\0', '8', '\1', '8', '8', '\234', '\0', '\234', '\1', '\0', '\1', '8', '\0', '\1', '\0', '\uFFFF', '8', '\1', '\0', '\1', '\0', '\uFFFF', '8', '\uFFFF', '\1', '8', '\uFFFF', '\1', '8', '\uFFFF', '\234', '\0', '\uFFFF', '\0', '\0', '\uFFFF', '8', '\234', '\0', '\234', '8', '\1', '8', '\0', '\234', '8', '\234', '\uFFFF', '8', '\uFFFF', '\0', '\234', '\1', '8', '\0', '\uFFFF', '\234', '8', '\uFFFF', '8', '\uFFFF', '\1', '\1', '\0', '\uFFFF', '\uFFFF', '\234', '\0', '\234'}, -2147483648, -1, new MathContext("precision=2147483647 roundingMode=FLOOR"));
}
catch (java.lang.NumberFormatException e) {
caught = true;
}
Assert.assertEquals("91.94630872483222%", true, caught);
}