Skip to content

Commit

Permalink
[wpimath] Update to gcem 1.17.0 (#5575)
Browse files Browse the repository at this point in the history
  • Loading branch information
calcmogul authored Aug 28, 2023
1 parent cf86af7 commit 0d2d989
Show file tree
Hide file tree
Showing 66 changed files with 163 additions and 86 deletions.
2 changes: 1 addition & 1 deletion upstream_utils/update_gcem.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


def main():
upstream_root = clone_repo("https://github.com/kthohr/gcem.git", "v1.16.0")
upstream_root = clone_repo("https://github.com/kthohr/gcem.git", "v1.17.0")
wpilib_root = get_repo_root()
wpimath = os.path.join(wpilib_root, "wpimath")

Expand Down
2 changes: 1 addition & 1 deletion wpimath/src/main/native/thirdparty/gcem/include/gcem.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
36 changes: 30 additions & 6 deletions wpimath/src/main/native/thirdparty/gcem/include/gcem_incl/exp.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down Expand Up @@ -28,6 +28,30 @@
namespace internal
{

// see https://en.wikipedia.org/wiki/Euler%27s_continued_fraction_formula

#if __cplusplus >= 201402L // C++14 version

template<typename T>
constexpr
T
exp_cf_recur(const T x, const int depth_end)
noexcept
{
int depth = GCEM_EXP_MAX_ITER_SMALL - 1;
T res = T(1);

while (depth > depth_end - 1) {
res = T(1) + x/T(depth - 1) - x/depth/res;

--depth;
}

return res;
}

#else // C++11 version

template<typename T>
constexpr
T
Expand All @@ -36,20 +60,20 @@ noexcept
{
return( depth < GCEM_EXP_MAX_ITER_SMALL ? \
// if
depth == 1 ? \
T(1) - x/exp_cf_recur(x,depth+1) :
T(1) + x/T(depth - 1) - x/depth/exp_cf_recur(x,depth+1) :
T(1) + x/T(depth - 1) - x/depth/exp_cf_recur(x,depth+1) :
// else
T(1) );
}

#endif

template<typename T>
constexpr
T
exp_cf(const T x)
noexcept
{
return( T(1)/exp_cf_recur(x,1) );
return( T(1) / (T(1) - x / exp_cf_recur(x,2)) );
}

template<typename T>
Expand All @@ -72,7 +96,7 @@ noexcept
//
is_neginf(x) ? \
T(0) :
//
// indistinguishable from zero
GCLIM<T>::min() > abs(x) ? \
T(1) :
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down Expand Up @@ -34,10 +34,20 @@ llint_t
find_exponent(const T x, const llint_t exponent)
noexcept
{
return( x < T(1) ? \
find_exponent(x*T(10),exponent - llint_t(1)) :
return( // < 1
x < T(1e-03) ? \
find_exponent(x * T(1e+04), exponent - llint_t(4)) :
x < T(1e-01) ? \
find_exponent(x * T(1e+02), exponent - llint_t(2)) :
x < T(1) ? \
find_exponent(x * T(10), exponent - llint_t(1)) :
// > 10
x > T(10) ? \
find_exponent(x/T(10),exponent + llint_t(1)) :
find_exponent(x / T(10), exponent + llint_t(1)) :
x > T(1e+02) ? \
find_exponent(x / T(1e+02), exponent + llint_t(2)) :
x > T(1e+04) ? \
find_exponent(x / T(1e+04), exponent + llint_t(4)) :
// else
exponent );
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down Expand Up @@ -53,7 +53,7 @@
#endif

#ifndef GCEM_VERSION_MINOR
#define GCEM_VERSION_MINOR 16
#define GCEM_VERSION_MINOR 17
#endif

#ifndef GCEM_VERSION_PATCH
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*################################################################################
##
## Copyright (C) 2016-2022 Keith O'Hara
## Copyright (C) 2016-2023 Keith O'Hara
##
## This file is part of the GCE-Math C++ library.
##
Expand Down
Loading

0 comments on commit 0d2d989

Please sign in to comment.