anchor.diff:  
     Value.FScale := LNumDecimals;
     Value.FValue := BigInteger(LIntValue);
  -  if LIsNegative then
  +  if not Value.FValue.IsZero and LIsNegative then
       Value.FValue.SetSign(-1);
     Result := True;
   end;
  
positive.code:   // terminate?                                                                                            //
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  
    if Right.FValue = BigInteger.Zero then
      Error(ecDivByZero, []);
    TargetScale := Left.Scale - Right.Scale;
    if Left.FValue.IsZero then
  
negative.code:   FScale := Scale;
  end;
  
  procedure MakeBigDecimal(Mantissa: UInt64; Exponent: Integer; Sign: TValueSign; var Result: BigDecimal);
  type
    TUInt64 = packed record
      Lo, Hi: UInt32;
    end;
  var
    BigInt: BigInteger;
    DecimalPoint: Integer;
    Shift: Integer;
  begin
    if UInt32(Mantissa) = 0 then
      Shift := 32 + NumberOfTrailingZeros(TUInt64(Mantissa).Hi)
    else
      Shift := NumberOfTrailingZeros(UInt32(Mantissa));
  
    Mantissa := Mantissa shr Shift;
    Inc(Exponent, Shift);
  
    // This can be shortcut with NTZ. Also only shift by Min(NTZ, -Exponent).
    while not Odd(Mantissa) do
    begin
      Mantissa := Mantissa shr 1;
      Inc(Exponent);
    end;
  
    BigInt := Mantissa;
  
    DecimalPoint := 0;
    if Exponent < 0 then
    begin
      BigInt := BigInt * BigInteger.Pow(5, -Exponent);
      DecimalPoint := -Exponent;
    end
    else if Exponent > 0 then
      BigInt := BigInt shl Exponent;
  
    Result := BigDecimal.Create(BigInt, DecimalPoint);
    if Sign < 0 then
      Result := -Result;
  end;
  
  constructor BigDecimal.Create(const S: Single);
  var
    Mantissa: UInt64;
    Exponent: Integer;
    Sign: TValueSign;
  begin
    if IsInfinite(S) or IsNan(S) then
      Error(ecInvalidArg, ['Single']);
  
    if S = 0.0 then
    begin
      Self := BigDecimal.Zero;
      Exit;
    end;
  
    Mantissa := GetMantissa(S);
    Exponent := GetExponent(S) - 23;
    Sign := System.Math.Sign(S);
  
    MakeBigDecimal(Mantissa, Exponent, Sign, Self);
  end;
  
  constructor BigDecimal.Create(const D: Double);
  var
    Mantissa: UInt64;
    Exponent: Integer;
    Sign: TValueSign;
  begin
    if IsInfinite(D) or IsNan(D) then
      Error(ecInvalidArg, ['Double']);
  
    if D = 0.0 then
    begin
      Self := BigDecimal.Zero;
      Exit;
    end;
  
    Mantissa := GetMantissa(D);
    Exponent := GetExponent(D) - 52;
    Sign := System.Math.Sign(D);
  
    MakeBigDecimal(Mantissa, Exponent, Sign, Self);
  end;
  
  {$IFDEF HasExtended}
  constructor BigDecimal.Create(const E: Extended);
  var
    Mantissa: UInt64;
    Exponent: Integer;
    Sign: TValueSign;
  begin
    if IsInfinite(E) or IsNan(E) then
      Error(ecInvalidArg, ['Extended']);
  
    if E = 0.0 then
    begin
      Self := BigDecimal.Zero;
      Exit;
    end;
  
    Mantissa := GetMantissa(E);
    Exponent := GetExponent(E) - 63;
    Sign := System.Math.Sign(E);
  
    MakeBigDecimal(Mantissa, Exponent, Sign, Self);
  end;
  {$ENDIF}
  
  