Austin Schuh | c6423e6 | 2017-02-11 16:56:30 -0800 | [diff] [blame] | 1 | #include "frc971/zeroing/wrap.h" |
| 2 | |
| 3 | #include <cmath> |
| 4 | |
| 5 | namespace frc971 { |
| 6 | namespace zeroing { |
| 7 | |
Austin Schuh | 4fae0fc | 2018-03-27 23:51:42 -0700 | [diff] [blame^] | 8 | float Wrap(float nearest, float value, float period) { |
| 9 | return remainderf(value - nearest, period) + nearest; |
| 10 | } |
| 11 | |
Austin Schuh | c6423e6 | 2017-02-11 16:56:30 -0800 | [diff] [blame] | 12 | double Wrap(double nearest, double value, double period) { |
Austin Schuh | 4fae0fc | 2018-03-27 23:51:42 -0700 | [diff] [blame^] | 13 | return remainder(value - nearest, period) + nearest; |
Austin Schuh | c6423e6 | 2017-02-11 16:56:30 -0800 | [diff] [blame] | 14 | } |
| 15 | |
| 16 | } // namespace zeroing |
| 17 | } // namespace frc971 |