Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A rare error when parsing huge integers #17

Open
axiopost opened this issue Apr 23, 2021 · 0 comments
Open

A rare error when parsing huge integers #17

axiopost opened this issue Apr 23, 2021 · 0 comments

Comments

@axiopost
Copy link

Hi,
I am writing a faster parser function than the original one and while testing it I raised up an error that may be reproduce with this code:

procedure AParsingError;
var
  N,M : BigInteger;
  R : IRandom;
begin
  R := TDelphiRandom.Create(-332888001);
  N := BigInteger.Create(Random(100)*1000, R);
  BigInteger.Base := 12;
  M := BigInteger.Parse(N.ToString);
  if (N<>M) then raise Exception.Create('Parsed value differs from the original!');
end;

The N.ToString and M.ToString differs per the digits from positions 1983 to 1992 (probabely a Limb).
In attached file uBadValue.zip
there is a unit file embeding the value produced by the random generator (18250 hex-digits long), just in case.

Best regards,
F. MARQUES

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant