Home
last modified time | relevance | path

Searched hist:"0 ab9d838" (Results 1 – 3 of 3) sorted by relevance

/openbmc/phosphor-virtual-sensor/
H A DexprtkTools.hpp0ab9d838 Tue Jul 19 02:12:50 CDT 2022 Lei YU <yulei.sh@bytedance.com> exprkt: Add maxIgnoreNaN to ignore the NaN value

The max function in exprtk uses std::max() to get the max value.
Comparing a value with nan has special rule and is not expected in
virtual sensor's case. E.g. `max(nan, 1)` gives `nan`.

Adding a new exprkt function `maxIgnoreNaN` to handle the above case so
that it ignores all `nan` values. If all values are `nan` then it
returns `nan`, otherwise it returns the max value of the valid values.

Example usage in json config:
```
"Expression": "maxIgnoreNaN(T0, T1, T2, T3)"
```

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: Idd345cd2ce325e5a186b9816458ba3d3bc66a187
H A DvirtualSensor.hpp0ab9d838 Tue Jul 19 02:12:50 CDT 2022 Lei YU <yulei.sh@bytedance.com> exprkt: Add maxIgnoreNaN to ignore the NaN value

The max function in exprtk uses std::max() to get the max value.
Comparing a value with nan has special rule and is not expected in
virtual sensor's case. E.g. `max(nan, 1)` gives `nan`.

Adding a new exprkt function `maxIgnoreNaN` to handle the above case so
that it ignores all `nan` values. If all values are `nan` then it
returns `nan`, otherwise it returns the max value of the valid values.

Example usage in json config:
```
"Expression": "maxIgnoreNaN(T0, T1, T2, T3)"
```

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: Idd345cd2ce325e5a186b9816458ba3d3bc66a187
H A DvirtualSensor.cpp0ab9d838 Tue Jul 19 02:12:50 CDT 2022 Lei YU <yulei.sh@bytedance.com> exprkt: Add maxIgnoreNaN to ignore the NaN value

The max function in exprtk uses std::max() to get the max value.
Comparing a value with nan has special rule and is not expected in
virtual sensor's case. E.g. `max(nan, 1)` gives `nan`.

Adding a new exprkt function `maxIgnoreNaN` to handle the above case so
that it ignores all `nan` values. If all values are `nan` then it
returns `nan`, otherwise it returns the max value of the valid values.

Example usage in json config:
```
"Expression": "maxIgnoreNaN(T0, T1, T2, T3)"
```

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: Idd345cd2ce325e5a186b9816458ba3d3bc66a187