rvelthuis / DelphiBigNumbers

BigInteger and BigDecimal for Delphi
http://rvelthuis.de/programs/bigintegers.html
BSD 2-Clause "Simplified" License
119 stars 62 forks source link

Wrong exception message if calculate Sqrt of negative number #8

Closed Safrad closed 5 years ago

Safrad commented 5 years ago

SNegativeRadicand contains "%s", so replace raise EInvalidArgument.Create(SNegativeRadicand); with raise EInvalidArgument.CreateFmt(SNegativeRadicand, ErrorInfo); in class procedure BigInteger.Error(ErrorCode: TErrorCode; const ErrorInfo: array of const); begin case ErrorCode of ecParse: raise EConvertError.CreateFmt(SErrorParsingFmt, ErrorInfo); ecDivbyZero: raise EZeroDivide.Create(SDivisionByZero); ecConversion: raise EConvertError.CreateFmt(SConversionFailedFmt, ErrorInfo); ecOverflow: raise EOverflow.Create(SOverflow); ecInvalidArgFloat: raise EInvalidArgument.CreateFmt(SInvalidArgumentFloatFmt, ErrorInfo); ecInvalidBase: raise EInvalidArgument.Create(SInvalidArgumentBase); ecInvalidArg: raise EInvalidArgument.CreateFmt(SInvalidArgumentFmt, ErrorInfo); ecNoInverse: raise EInvalidArgument.Create(SNoInverse); ecNegativeExponent: raise EInvalidArgument.CreateFmt(SNegativeExponent, ErrorInfo); ecNegativeRadicand: raise EInvalidArgument.Create(SNegativeRadicand); else raise EInvalidOp.Create(SInvalidOperation); end; end;

rvelthuis commented 5 years ago

Solved with raise EInvalidAgument.CreateFmt(SNegativeRadicand, ErrorInfo)