32 lines
619 B
C++
32 lines
619 B
C++
/*
|
||
* SignalSwitch.cpp
|
||
*
|
||
* Created on: 1 окт. 2019 г.
|
||
* Author: user
|
||
*/
|
||
|
||
#include "SignalSwitch.hh"
|
||
|
||
#include <cmath>
|
||
|
||
using namespace std;
|
||
|
||
systemic::detail::SignalSwitch::operator float() const {
|
||
const float value_a = a;
|
||
const float value_b = b;
|
||
|
||
if( isfinite( value_a ) && isfinite( value_b ) )
|
||
return ( value_a + value_b ) * 0.5f;
|
||
else if( isfinite( value_a ) )
|
||
return value_a;
|
||
else if( isfinite( value_b ) )
|
||
return value_b;
|
||
else
|
||
return NAN;
|
||
|
||
}
|
||
|
||
systemic::detail::SignalSwitch::operator bool() const {
|
||
return isfinite( operator float() );
|
||
}
|