homieiot / convention

🏡 The Homie Convention: a lightweight MQTT convention for the IoT
https://homieiot.github.io/
Other
710 stars 59 forks source link

Float range in Convention wrong? #167

Closed zocker1996 closed 5 years ago

zocker1996 commented 5 years ago

Section 2.2.3 of the convention states: "Floats range from 2^-1074 to (2-2^-52)*2^1023" Is this correct? Neither of this numbers is negative, and 0 is not included in this intervall. This leads me to think that either my interpretation of these mathematical expressions is wrong, or that maybe the minus sign should not be part of the power in the first expression.

davidgraeff commented 5 years ago

You are right. Might make sense to under-specify in this case actually.

zocker1996 commented 5 years ago

I'm currently implementing a homie library for dart and need the max and min value as constants. Could you write them down here?

davidgraeff commented 5 years ago

Use IEE754 min/max for 32bit precision (https://en.wikipedia.org/wiki/IEEE_754-1985). Afaik that's what we have settled on and all 32/64-bit cpu's and mcu's can handle.

zocker1996 commented 5 years ago

Thanks! The library is now documented and released. It can be found here: https://pub.dev/packages/homie_dart Would you consider listing it in the implementations tab?

davidgraeff commented 5 years ago

Looks great! Sure I can do that. The website a repo here on the homieiot "organisation" as well btw :)