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

Error BigRational.Pow #12

Open
MaKeSter333 opened this issue May 8, 2023 · 2 comments
Open

Error BigRational.Pow #12

MaKeSter333 opened this issue May 8, 2023 · 2 comments

Comments

@MaKeSter333
Copy link

Console.WriteLine(BigRational.Pow(BigRational.Parse("2"), BigRational.Parse("1024")).ToString("F5000").Trim('0').Trim('.').Trim(','));

output:
179769313486231590772930519088622001011118896214832765155304275349863344832230481635579222589753905511470408352693059293915016093195361235646204211316618291270358047266252361344772967473693272614986720710237742201778406260548280080727716004012369601250654400739018446628865972481023592362912353548367809468670,72419534065285259505027929807

This answer is incorrect. Right:

179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216

@mikkleini
Copy link

mikkleini commented Oct 24, 2023

Hit the same/similar case, but here's a simpler way to reproduce:

BigRational x;

x = BigRational.Pow((int)3, (int)3);
Debug.WriteLine(x.ToString());

x = BigRational.Pow(new BigRational(3), new BigRational(3));
Debug.WriteLine(x.ToString());

(Diagnostic console) output is:

27
26,999999999999999999999999999989…

@mikkleini
Copy link

Ping @c-ohle

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

2 participants