MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/schematic/SignalSwitch.cpp
2024-06-07 11:12:56 +03:00

32 lines
619 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* 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() );
}