blob: 593ac97b141a570c7095eb14ec72403be2224ae2 [file] [log] [blame]
Austin Schuhc6423e62017-02-11 16:56:30 -08001#include "frc971/zeroing/wrap.h"
2
3#include <cmath>
4
5namespace frc971 {
6namespace zeroing {
7
Austin Schuh4fae0fc2018-03-27 23:51:42 -07008float Wrap(float nearest, float value, float period) {
9 return remainderf(value - nearest, period) + nearest;
10}
11
Austin Schuhc6423e62017-02-11 16:56:30 -080012double Wrap(double nearest, double value, double period) {
Austin Schuh4fae0fc2018-03-27 23:51:42 -070013 return remainder(value - nearest, period) + nearest;
Austin Schuhc6423e62017-02-11 16:56:30 -080014}
15
16} // namespace zeroing
17} // namespace frc971