[wadalabfont-kit] / java / Flonum.java  

View of /java/Flonum.java

Parent Directory | Revision Log
Revision: 1.1.1.1 - (download) (as text) (annotate) (vendor branch)
Thu Dec 28 08:54:22 2000 UTC (23 years, 11 months ago) by ktanaka
Branch: ktanaka, MAIN
CVS Tags: SNAP-20030702, tmp, SNAP-20030624, SNAP-20030630, SNAP-20040518, HEAD
Changes since 1.1: +0 -0 lines
change to CVS wadalab font project
//
//
//
final public class Flonum extends LispObject{
  double val;
  Flonum(double val){ this.val=val; }
  Flonum(String name){
    int index=name.indexOf('^');
    double pow=0.0;
    if(index!= -1){
      pow=new Double(name.substring(index+1)).doubleValue();
      name=name.substring(0,index);
    }
    this.val=new Double(name).doubleValue()*Math.pow(10,pow);
  }
  public int getType(){ return FLONUM; }
  public double getVal(){ return val; }
  public String toString(){ return ""+val; }
  public static boolean isFlonumString(String name){
    int index=name.indexOf('^');
    if(index!= -1){
      if(!Fixnum.isFixnumString(name.substring(index+1))) return false;
      name=name.substring(0,index);
    }
    index=name.indexOf('.');
    if(index!= -1){
      if(name.length()==1) return false;
      if(!Fixnum.isFixnumString(name.substring(index+1))) return false;
      name=name.substring(0,index);
    }
    if(!Fixnum.isFixnumString(name)) return false;
    return true;
  }
}

ktanaka

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help