Skip to content

Commit aefe8d4

Browse files
committed
avoid doubles
1 parent 54921df commit aefe8d4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Datapoint/Converter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void Div10Convert::encode(uint8_t* buf, uint8_t len, const VariantValue& val) co
2828
assert(len == 1 || len == 2);
2929
(void) len;
3030
float srcVal = val;
31-
int16_t tmp = floor((srcVal * 10.f) + 0.5);
31+
int16_t tmp = std::floor((srcVal * 10.f) + 0.5f);
3232
if (len == 2) {
3333
buf[1] = tmp >> 8;
3434
}
@@ -47,7 +47,7 @@ void Div2Convert::encode(uint8_t* buf, uint8_t len, const VariantValue& val) con
4747
assert(len == 1);
4848
(void) len;
4949
float srcVal = val;
50-
int8_t tmp = floor((srcVal * 2.f) + 0.5);
50+
int8_t tmp = std::floor((srcVal * 2.f) + 0.5f);
5151
buf[0] = tmp;
5252
}
5353

@@ -63,7 +63,7 @@ void Div3600Convert::encode(uint8_t* buf, uint8_t len, const VariantValue& val)
6363
assert(len == 4);
6464
(void) len;
6565
float srcVal = val;
66-
uint32_t tmp = floor((srcVal * 3600.f) + 0.5);
66+
uint32_t tmp = std::floor((srcVal * 3600.f) + 0.5f);
6767
buf[3] = tmp >> 24;
6868
buf[2] = tmp >> 16;
6969
buf[1] = tmp >> 8;

0 commit comments

Comments
 (0)