Skip to content

Commit 36ea448

Browse files
UF4007arturbac
andauthored
MSVC compile compatible (#13)
* to_string() and from_string() Added to_string and from_string methods that are not related to floating point numbers * fixed_string unit_test updated. Generated by the Cursor, checked by me. I simply run it in MSVC and no error is found. I am very glad that you replied so fast. Under my test, your lib is fast enough for a gaming environment, except a little bit slow on division. But there is some critical functions are missing: mod exp (power) log printf scanf (solved) hyperbolic sine * bug found and correct * that is right. * upgrade tests, fix constexpr in code * MSVC compile compatible When compiled in MSVC (VS 2022), those places above will lead to a compile failure. --------- Co-authored-by: Artur Bać <artur@ebasoft.com.pl>
1 parent 24c2154 commit 36ea448

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

fixed_lib/include/fixedmath/math.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -819,12 +819,12 @@ namespace detail
819819
{
820820
fixed_internal x2{mul_<prec_>(x, x)};
821821

822-
constexpr fixed_internal _35o9{div_<prec_>(35, 9) + 1};
823-
constexpr fixed_internal _5o7{div_<prec_>(5, 7) + 1};
824-
constexpr fixed_internal _3o5{div_<prec_>(3, 5) + 1};
825-
constexpr fixed_internal _1o3{div_<prec_>(1, 3)};
826-
constexpr fixed_internal _1{fix_<prec_>(1)};
827-
constexpr fixed_internal _63o11{div_<prec_>(63, 11) + 1};
822+
constexpr fixed_internal _35o9{div_<prec_>(fixed_internal{35}, fixed_internal{9}) + 1};
823+
constexpr fixed_internal _5o7{div_<prec_>(fixed_internal{5}, fixed_internal{7}) + 1};
824+
constexpr fixed_internal _3o5{div_<prec_>(fixed_internal{3}, fixed_internal{5}) + 1};
825+
constexpr fixed_internal _1o3{div_<prec_>(fixed_internal{1}, fixed_internal{3})};
826+
constexpr fixed_internal _1{fix_<prec_>(fixed_internal{1})};
827+
constexpr fixed_internal _63o11{div_<prec_>(fixed_internal{63}, fixed_internal{11}) + 1};
828828

829829
fixed_internal y6{_35o9 + mul_<prec_ + 1>(x2, _63o11)};
830830
fixed_internal y7{_5o7 + mul_<prec_ + 3>(x2, y6)};

perf_test_suite/perf.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <chrono>
88
#include <cmath>
99
#include <string_view>
10+
#include <numeric>
1011
using std::chrono::duration_cast;
1112
using std::chrono::microseconds;
1213
using std::chrono::milliseconds;
@@ -22,6 +23,8 @@ using std::tan;
2223
using std::sin;
2324

2425
using fixedmath::fixed_t;
26+
using fixedmath::phi;
27+
using namespace fixedmath::func;
2528

2629
using limits_ = std::numeric_limits<fixed_t>;
2730

0 commit comments

Comments
 (0)