Package uk.co.mmscomputing.math

Examples of uk.co.mmscomputing.math.Rational


    return data;
  }

  private double read1Real(ImageInputStream in)throws IOException{
    switch(type){
    case RATIONAL:  return new Rational((int)in.readUnsignedInt(),(int)in.readUnsignedInt()).doubleValue();
    case SRATIONAL: return new Rational(in.readInt(),in.readInt()).doubleValue();
    case FLOAT:     return in.readFloat();
    case DOUBLE:    return in.readDouble();
    default:/*error*/return 0;
    }
  }
View Full Code Here


  }

  protected void write1Real(ImageOutputStream out,double value)throws IOException{
    switch(type){
    case RATIONAL:
      Rational ur=new Rational(value);
      out.writeInt(ur.getNumerator());
      out.writeInt(ur.getDenominator());
      break;
    case SRATIONAL:
      Rational sr=new Rational(value);
      out.writeInt(sr.getNumerator());
      out.writeInt(sr.getDenominator());
      break;
    case FLOAT: 
      val=Float.floatToIntBits((float)value);
      break;
    case DOUBLE:
View Full Code Here

  protected void writeReal(ImageOutputStream out,double value)throws IOException{
    switch(type){
    case RATIONAL:
      val=out.getStreamPosition();             // address to rational
      Rational ur=new Rational(value);
      out.writeInt(ur.getNumerator());
      out.writeInt(ur.getDenominator());
      break;
    case SRATIONAL:
      val=out.getStreamPosition();             // address to rational
      Rational sr=new Rational(value);
      out.writeInt(sr.getNumerator());
      out.writeInt(sr.getDenominator());
      break;
    case FLOAT: 
      val=Float.floatToIntBits((float)value)// size of float is 4 byte, hence we can save this in idf entry
      break;
    case DOUBLE:
View Full Code Here

TOP

Related Classes of uk.co.mmscomputing.math.Rational

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.