Examples of precision()


Examples of java.math.BigDecimal.precision()

                 * response by the BigDecimal.pow library or integer overflow.
                 */
                while (exSc > 0) {
                    int exsub = Math.min(8, exSc);
                    exSc -= exsub;
                    MathContext mctmp = new MathContext(expxby10.precision() - exsub + 2);
                    int pex = 1;
                    while (exsub-- > 0)
                        pex *= 10;
                    expxby10 = expxby10.pow(pex, mctmp);
                }
View Full Code Here

Examples of java.math.BigDecimal.precision()

            /*
             * add intermediately 2 digits to the partial sum accumulation
             */
            z = scalePrec(z, 2);
            MathContext mcloc = new MathContext(z.precision());

            /*
             * measure of the absolute error is the relative error in the first, logarithmic term
             */
            double eps = x.ulp().doubleValue() / x.doubleValue();
View Full Code Here

Examples of java.math.BigDecimal.precision()

             */
            BigDecimal R = addRound(z.re, divideRound(multiplyRound(z.im, z.im), z.re));
            BigDecimal I = addRound(z.im, divideRound(multiplyRound(z.re, z.re), z.im));
            MathContext mc = new MathContext(1 + R.precision());
            R = BigDecimal.ONE.divide(R, mc);
            mc = new MathContext(1 + I.precision());
            I = BigDecimal.ONE.divide(I, mc);
            return new BigComplex(R, I.negate());
        }
    }

View Full Code Here

Examples of java.math.BigDecimal.precision()

        /*
         * la précision doit être >= 0...
         */
        if(p<0) throw new InterpreterException(StdErrors.extend(StdErrors.Out_of_range, "precision "+p+" must be >= 0" ));
        BigDecimal r=number.get();
        int digits=r.precision()-r.scale();
        MathContext mc=context.get();
        MathContext nmc = new MathContext(digits<0 ? p+1 : p + digits, mc.getRoundingMode()); // more precision...
        context.getAndSet( nmc );                 
        return null;
    }
View Full Code Here

Examples of java.math.BigDecimal.precision()

     * @throws Exception
     */
    public Node external_get_precision(Node startAt) throws Exception {
        startAt.isGoodArgsCnt(1);
        BigDecimal r=number.get();
        int digits=r.precision()-r.scale();
        MathContext mc=context.get();
        return new Node(digits<0 ? Math.abs(digits)-1 : mc.getPrecision() - digits);
    }
   
    /**
 
View Full Code Here

Examples of java.math.BigDecimal.precision()

    public Node external_precision(Node startAt) throws Exception {
        startAt.isGoodArgsCnt(2);
        int c=(int)startAt.getSubNode(1, Node.TYPE_NUMBER).getNumber();
        if(c<0) throw new InterpreterException(StdErrors.extend(StdErrors.Out_of_range, "precision "+c+" must be >= 0" ));
        BigDecimal r=number.get();
        int digits=r.precision()-r.scale();
        MathContext mc=context.get();
        MathContext nmc = new MathContext(digits<0 ? c+1 : c + digits, mc.getRoundingMode()); // more precision...
        return Node.createExternal(new External_Decimal(number.get().round(nmc),nmc));
    }
   
View Full Code Here

Examples of java.math.BigDecimal.precision()

    public Node external_mutator_precision(Node startAt) throws Exception {
        startAt.isGoodArgsCnt(2);
        int c=(int)startAt.getSubNode(1, Node.TYPE_NUMBER).getNumber();
        if(c<0) throw new InterpreterException(StdErrors.extend(StdErrors.Out_of_range, "precision "+c+" must be >= 0" ));
        BigDecimal r=number.get();
        int digits=r.precision()-r.scale();
        MathContext mc=context.get();
        context.getAndSet( new MathContext(digits<0 ? c+1 : c + digits, mc.getRoundingMode()) );
        number.getAndSet(number.get().round(context.get()));
        return null;
    }
View Full Code Here

Examples of java.math.BigDecimal.precision()

        else{
            //string et objet...
            String sn=Node.node2VString(arg0).getString();
            MathContext mc=context.get();
            BigDecimal v=new BigDecimal(sn);
            if(v.precision()>mc.getPrecision())
                context.getAndSet( new MathContext(v.precision(),mc.getRoundingMode()) );
            number.getAndSet( v );
        }
        return null;
    }
View Full Code Here

Examples of java.math.BigDecimal.precision()

            //string et objet...
            String sn=Node.node2VString(arg0).getString();
            MathContext mc=context.get();
            BigDecimal v=new BigDecimal(sn);
            if(v.precision()>mc.getPrecision())
                context.getAndSet( new MathContext(v.precision(),mc.getRoundingMode()) );
            number.getAndSet( v );
        }
        return null;
    }
View Full Code Here

Examples of javax.persistence.Column.precision()

    assertTrue( column.insertable() );
    assertTrue( column.updatable() );
    assertEquals( "", column.columnDefinition() );
    assertEquals( "", column.table() );
    assertEquals( 255, column.length() );
    assertEquals( 0, column.precision() );
    assertEquals( 0, column.scale() );
  }

  public void testColumnAllAttributes() throws Exception {
    reader = getReader( Entity3.class, "field1", "element-collection.orm17.xml" );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.