Package jscicalc

Examples of jscicalc.Notation


    m = calc.matcher( line );
    if( !m.find() ){
        String expressionString = line;
        Object o = parse( expressionString, b );
        if( o instanceof Complex ){
      Notation n = new Notation();
      n.setRectangular();
      n.setComplex();
      n.setStandard();
      ++tests;
      if( checkNumber( expressionString, (Complex)o, n, b ) )
          ++successes;
      n.setScientific();
      ++tests;
      if( checkNumber( expressionString, (Complex)o, n, b ) )
          ++successes;
      n.setNonComplex();
      n.setStandard();
      ++tests;
      if( checkNumber( expressionString, (Complex)o, n, b ) )
          ++successes;
      n.setScientific();
      ++tests;
      if( checkNumber( expressionString, (Complex)o, n, b ) )
          ++successes;
      n.setPolar();
      n.setComplex();
      n.setStandard();
      ++tests;
      if( checkNumber( expressionString, (Complex)o, n, b ) )
          ++successes;
      n.setScientific();
      ++tests;
      if( checkNumber( expressionString, (Complex)o, n, b ) )
          ++successes;
      n.setNonComplex();
      n.setStandard();
      ++tests;
      if( checkNumber( expressionString, (Complex)o, n, b ) )
          ++successes;
      n.setScientific();
      ++tests;
      if( checkNumber( expressionString, (Complex)o, n, b ) )
          ++successes;
        } else {
      System.out.print( "Failed on: " );
View Full Code Here


     * @param base The base
     */
    public DoubleFormat( double number, Base base ){
  this.number = number;
  this.base = base;
  this.notation = new Notation();
  setPrecision( maxPrecision() );
    }
View Full Code Here

     * Standard test function.
     * @param args Standard arguments.
     */
    public static void main( String[] args ){
  DoubleFormat d = new DoubleFormat( -4.2035492222884317E-246, Base.DECIMAL );
  Notation n = new Notation();
  n.setScientific();
  d.setNotation( n );
  DoubleFormat.HTMLStringRepresentation s = d.representation();
  System.out.print( s.string + " (length = " );
  System.out.print( s.length );
  System.out.println( ")" );
View Full Code Here

              "maxChars must be at least four" );
  if( precision < 1 )
      throw new RuntimeException( "Complex.toHTMLSubString" +
              "precision must be positive" );

  Notation n = new Notation();
  if( notation.standard() ) n.setStandard();
  else n.setScientific();
  if( notation.complex() ) n.setComplex();
  else n.setNonComplex();
  if( notation.rectangular() ) n.setRectangular();
  else n.setPolar();

  if( n.standard() ){
      result = tryHTMLString( maxChars, precision, base, n ).stringVector;
      if( result != null ) return result;
  }
  // force scientific notation
  n.setScientific();
 
  result = tryHTMLString( maxChars, precision, base, n ).stringVector;
  if( result != null ) return result;
  else {
      result = new jscicalc.StringArray();
View Full Code Here

              "maxChars must be at least four" );
  if( precision < 1 )
      throw new RuntimeException( "Complex.toHTMLParenString" +
              "precision must be positive" );

  Notation n = new Notation();
  if( notation.standard() ) n.setStandard();
  else n.setScientific();
  if( notation.complex() ) n.setComplex();
  else n.setNonComplex();
  if( notation.rectangular() ) n.setRectangular();
  else n.setPolar();

  HTMLStringResult result;
  if( n.standard() ){
      result = tryHTMLString( maxChars, precision, base, n );
      if( result.stringVector != null ){
    if( result.parentheses ){
        v.add( "(" );
        v.addAll( result.stringVector );
        v.add( ")" );
        return v;
    } else
        return result.stringVector;
      }
  }
  // force scientific notation
  n.setScientific();
 
  result = tryHTMLString( maxChars, precision, base, n );
  if( result.stringVector != null ){
      if( result.parentheses ){
    v.add( "(" );
View Full Code Here

              final Base base, final Notation notation ){
  // set up
  HTMLStringResult result = new HTMLStringResult();
  DoubleFormat x;
  DoubleFormat y;
  Notation xn = new Notation();
  Notation yn = new Notation();
  if( notation.rectangular() ){
      x = new DoubleFormat( real(), base );
      y = new DoubleFormat( imaginary(), base );
      if( notation.scientific() ){
    xn.setScientific();
    yn.setScientific();
      }
  } else { // polar
      x = new DoubleFormat( abs(), base );
      y = new DoubleFormat( arg(), base );
      if( notation.scientific() ){
View Full Code Here

TOP

Related Classes of jscicalc.Notation

Copyright © 2018 www.massapicom. 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.