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

wrong Double to UInt256 conversion #32

Open
Abalioha opened this issue Aug 7, 2023 · 1 comment · May be fixed by #33
Open

wrong Double to UInt256 conversion #32

Abalioha opened this issue Aug 7, 2023 · 1 comment · May be fixed by #33

Comments

@Abalioha
Copy link

Abalioha commented Aug 7, 2023

Issue can be easily tested with this snippet:

double d = 1E+20d;
UInt256 u = (UInt256)d; 
Console.WriteLine(u);   // 0
@Abalioha
Copy link
Author

Abalioha commented Aug 7, 2023

The problem goes deeper to
Lsh(in UInt256 x, int n, out UInt256 res)
when in and out params are the same

        var u = new UInt256(1);
        UInt256.Lsh(in u, 1, out u);
        Console.WriteLine(u);   // 0

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