limit for REALTIME (PHPFINA) value

hi,

I would like to know how large a value for an kWh accumulator can grow, before reaching its own limit?

Thanks

Mik

Robert Wall's picture

Re: limit for REALTIME (PHPFINA) value

I have not checked the source code, my guess (and it is just that) is it's a long integer, so 231 - 1.

mik.open's picture

Re: limit for REALTIME (PHPFINA) value

Looking at the documentation https://github.com/openenergymonitor/documentation/blob/master/BuildingB... the data is stored in 4 byte worth of data.

The data is written as a binary string (format float) using pack("f",$value).

But I'm still not sure if this representation is https://en.wikipedia.org/wiki/Single-precision_floating-point_format.

Robert Wall's picture

Re: limit for REALTIME (PHPFINA) value

What does the PHP manual say about "pack" and floating point?

chaveiro's picture

Re: limit for REALTIME (PHPFINA) value

PHP size of a float is platform-dependent, 32 or 64 bits.
MySQL we use float with single precision that is four bytes 32bits and this will be the limit.

The answer is tricky because depends on precision of the value that will fit 32bits:

Minimun value: ±1.18×10^-38
Maximal value: ±3.4×10^38

See: http://en.wikipedia.org/wiki/IEEE_floating_point

[Duplicate post deleted - Moderator (RW)]

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.