anchor.diff:  
   constructor BigRational.Create(const Numerator: Integer);
   begin
  -  FNum := BigInteger(Numerator);
  -  FDenom := BigInteger.One;
  +  FNumerator := BigInteger(Numerator);
  +  FDenominator := BigInteger.One;
   end;
   
   constructor BigRational.Create(const Numerator: Integer; const Denominator: Cardinal);
   begin
  -  FNum := BigInteger(Numerator);
  -  FDenom := BigInteger(Denominator);
  +  FNumerator := BigInteger(Numerator);
  +  FDenominator := BigInteger(Denominator);
     Normalize;
   end;
   
   constructor BigRational.Create(const Numerator, Denominator: BigInteger);
   begin
  -  FNum := Numerator;
  -  FDenom := Denominator;
  +  FNumerator := Numerator;
  +  FDenominator := Denominator;
     Normalize;
   end;
   
   constructor BigRational.Create(const Numerator: BigInteger);
   begin
  -  FNum := Numerator;
  -  FDenom := BigInteger.One;
  +  FNumerator := Numerator;
  +  FDenominator := BigInteger.One;
   end;
   
   constructor BigRational.Create(const ADouble: Double);
  -begin
  -
  +var
  +  Exponent: Integer;
  +  Mantissa: Int64;
  +begin
  +  if ADouble = 0.0 then
  +  begin
  +    FNumerator := BigInteger.Zero;
  +    FDenominator := BigInteger.One;
  +    Exit;
  +  end;
  +
  +  Exponent := GetExponent(ADouble);
  +  Mantissa := GetMantissa(ADouble);
  +
  +  // TODO: resource strings, private error method.
  +
  +  if IsNegativeInfinity(ADouble) or IsPositiveInfinity(ADouble) then
  +    Error(ecNoInfinity, []);
  +
  +  //$$RV: Untested, until now. --> adjust values where necessary.
  +  if IsDenormal(ADouble) then
  +  begin
  +    FNumerator := Mantissa;
  +    FDenominator := BigInteger.Zero.FlipBit(1023);
  +  end
  +  else
  +  begin
  +    FDenominator := BigInteger.Zero.FlipBit(53);
  +    FNumerator := Mantissa;
  +    if Exponent < 0 then
  +      FDenominator := FDenominator shl -Exponent
  +    else
  +      FNumerator := FNumerator shl Exponent;
  +  end;
  +  if ADouble < 0 then
  +    FNumerator := -FNumerator;
  +  Normalize;
   end;
   
   class function BigRational.Compare(const Left, Right: BigRational): Integer;
   begin
  -  Result := BigInteger.Compare(Left.FNum * Right.FDenom, Right.FNum * Left.FDenom);
  +  if Left.FDenominator = Right.FDenominator then
  +    Result := BigInteger.Compare(Left.FNumerator, Right.FNumerator)
  +  else
  +    Result := BigInteger.Compare(Left.FNumerator * Right.FDenominator, Right.FNumerator * Left.FDenominator);
   end;
   
   constructor BigRational.Create(const Numerator: Int64; const Denominator: UInt64);
   begin
  -  FNum := BigInteger(Numerator);
  -  FDenom := BigInteger(Denominator);
  +  FNumerator := BigInteger(Numerator);
  +  FDenominator := BigInteger(Denominator);
     Normalize;
   end;
   
   constructor BigRational.Create(const Numerator: Int64);
   begin
  -  FNum := BigInteger(Numerator);
  -  FDenom := BigInteger.One;
  +  FNumerator := BigInteger(Numerator);
  +  FDenominator := BigInteger.One;
   end;
   
   class function BigRational.Divide(const Left, Right: BigRational): BigRational;
   begin
  -  Result.FNum := Left.FNum * Right.FDenom;
  -  Result.FDenom := Left.FDenom * Right.FNum;
  +  if Left.FDenominator = Right.FDenominator then
  +  begin
  +    Result.FNumerator := Left.FNumerator;
  +    Result.FDenominator := Right.FNumerator;
  +  end
  +  else
  +  begin
  +    Result.FNumerator := Left.FNumerator * Right.FDenominator;
  +    Result.FDenominator := Left.FDenominator * Right.FNumerator;
  +  end;
     Result.Normalize;
   end;
   
  
positive.code: unit Velthuis.BigRationals;
  
  interface
  
  
negative.code: type
    BigRational = record
    private
      type
        ErrorCode = (ecDivByZero, ecBadArgument, ecNoInfinity, ecZeroDenominator);
  
      var
        FNumerator: BigInteger;
        FDenominator: BigInteger;
  
      function GetSign: Integer;
      procedure Normalize;
      procedure Error(Code: ErrorCode; Additional: array of const);
    public
      class var
        Zero: BigRational;
        OneTenth: BigRational;
        OneFourth: BigRational;
        OneThird: BigRational;
        OneHalf: BigRational;
        TwoThirds: BigRational;
        ThreeFourths: BigRational;
        One: BigRational;
        Ten: BigRational;
  
      class constructor Initialize;
  
      constructor Create(const Numerator, Denominator: BigInteger); overload;
      constructor Create(const Numerator: BigInteger); overload;
      constructor Create(const Numerator: Integer); overload;
      constructor Create(const Numerator: Integer; const Denominator: Cardinal); overload;
      constructor Create(const ADouble: Double); overload; // exact value of double, i.e. dividing mantissa by 2^53, etc.
      constructor Create(const Numerator: Int64); overload;
      constructor Create(const Numerator: Int64; const Denominator: UInt64); overload;
      constructor Create(const Value: string); overload;
      // TODO: Create(const Value: Double; MaxDenominator: Integer); overload; // gets best approximation
      // TODO: Create(const Value: Double; MaxEpsilon: Double); overload; // gets best approximation
  
      class function Add(const Left, Right: BigRational): BigRational; static;
      class operator Add(const Left, Right: BigRational): BigRational; static;
  