>>14337725C# is just Microsoft's Java
using System;
public class ErrAdjustedDoubleFloat {
private double number,error;
public ErrAdjustedDoubleFloat(double number, double error) {
this.number = number;
this.error = Math.Abs(error);
}
public ErrAdjustedDoubleFloat addWith(ErrAdjustedDoubleFloat addable){
double number,error;
number=this.number+addable.number;
error=this.error+addable.error;
return new ErrAdjustedDoubleFloat(number,error);
}
public ErrAdjustedDoubleFloat subtractWith(ErrAdjustedDoubleFloat subtractable){
double number,error;
number=this.number-subtractable.number;
error=this.error+subtractable.error;
return new ErrAdjustedDoubleFloat(number,error);
}
public ErrAdjustedDoubleFloat multiplyWith(ErrAdjustedDoubleFloat multiplible){
double number,error;
number=this.number*multiplible.number;
error=this.error*Math.Abs(multiplible.number)+multiplible.error*Math.Abs(this.number)+this.error*multiplible.error;
return new ErrAdjustedDoubleFloat(number,error);
}
public override String ToString() {
return "ErrAdjustedDoubleFloat{" + "number=" + number + ", error=" + error + '}';
}
public static void Main(String[] args) {
ErrAdjustedDoubleFloat a=new ErrAdjustedDoubleFloat(1d/3,1e-9);
ErrAdjustedDoubleFloat b=new ErrAdjustedDoubleFloat(2d/3,1e-9);
Console.WriteLine(a.addWith(b));
Console.WriteLine(a.subtractWith(b));
Console.WriteLine(a.multiplyWith(b));
}
}