scipr-lab / libff

C++ library for Finite Fields and Elliptic Curves
Other
149 stars 82 forks source link

This casting causes wrong output in my system. #109

Closed Jun-Hee-Lee closed 1 year ago

Jun-Hee-Lee commented 1 year ago

Hello, I'm analyzing your fantastic codes. I had got trouble doing print values.

Below one line is your code in the file "libff/common/double.cpp" return round((size_t) val.real());

I think it should be changed to the following: return (size_t) round(val.real());

If I test your code as the following: std::cout << round((size_t)(double)(3.9999999999999999)) << std::endl; It prints 3.

Thank you