robocin / ssl-core

MIT License
11 stars 0 forks source link

Add fuzzy_compare library #62

Closed joseviccruz closed 4 months ago

joseviccruz commented 4 months ago

Original PR: https://github.com/robocin/robocin-cpp/pull/1

This pull request adds the _fuzzycompare library, a C++ library that provides comparison methods and functors to working with floating-point numbers. The library includes several methods for comparing floating-point values that take into account floating-point rounding errors and other issues that can arise when working with these types of numbers.

The library is designed to be easy to use and to integrate into existing C++ projects. It includes a set of comparison functors that can be used with the standard library's algorithms, as well as a set of comparison methods that can be used with user-defined types.

Overall, the fuzzy_compare library should make it easier and more reliable to compare floating-point numbers in C++ projects, and should help to reduce bugs and errors that can arise from working with these types of numbers.

Also, the library adds a CMake configure file capable of setting epislon values for float, double and long double during build.

joseviccruz commented 4 months ago

Opening this PR but it has already been reviewed previously, see: robocin/robocin-cpp#1.

There are a few minor differences:

Feel free to double check and understand/comment on the documentation/coding standards used. Although there are many changes, this is due to READMEs and unit tests, the code itseld added is "small".

mhco0 commented 4 months ago

What happened with the RobôCin copyright? @joseviccruz

joseviccruz commented 4 months ago

What happened with the RobôCin copyright? @joseviccruz

It was removed in fact, we will not use it in this project.

joseviccruz commented 4 months ago

Thank you!

I just have some points about tests naming and comments.

I'll remove some comments that are just noise, thanks!

And also, just to clarify, in what other cases/tests the files of internal/test would be used?

Also, about internal. internal or detail contain code that we don't want to be exposed to the user (or sometimes is just an way to hide implementation details), there are some examples in widely used libraries as: absl/strings, repr, boost/pfr, nlohmann/json, foonathan/memory... There are used even on standard library: gcc.