Commit 583757f6 authored by Pavel Vainerman's avatar Pavel Vainerman

minor fix: pow10() --> pow()

parent a78dbd78
......@@ -17,7 +17,7 @@
Name: libuniset2
Version: 2.7
Release: alt2.1
Release: alt3
Summary: UniSet - library for building distributed industrial control systems
License: LGPL
......@@ -518,6 +518,9 @@ rm -f %buildroot%_libdir/*.la
# history of current unpublished changes
%changelog
* Thu Feb 01 2018 Pavel Vainerman <pv@altlinux.ru> 2.7-alt3
- minor fixes
* Wed Jan 10 2018 Alexei Takaseev <taf@altlinux.org> 2.7-alt2.1
- Rebuild with poco 1.8.1
......
......@@ -205,7 +205,7 @@ void DBServer_MySQL::sensorInfo( const uniset::SensorMessage* si )
<< endl;
}
float val = (float)si->value / (float)pow10(si->ci.precision);
float val = (float)si->value / (float)pow(10.0, si->ci.precision);
// см. DBTABLE AnalogSensors, DigitalSensors
ostringstream data;
......
......@@ -187,7 +187,7 @@ void DBServer_SQLite::sensorInfo( const uniset::SensorMessage* si )
<< endl;
}
float val = (float)si->value / (float)pow10(si->ci.precision);
float val = (float)si->value / (float)pow(10.0, si->ci.precision);
// см. DBTABLE AnalogSensors, DigitalSensors
ostringstream data;
......
......@@ -659,7 +659,7 @@ static void test_write10_F2( const float& val )
si.id = 2007;
si.node = conf->getLocalNode();
IOController_i::CalibrateInfo cal = ui->getCalibrateInfo(si);
float fval = (float)ui->getValue(si.id) / pow10(cal.precision);
float fval = (float)ui->getValue(si.id) / pow(10.0, cal.precision);
REQUIRE( fval == val );
}
......@@ -680,7 +680,7 @@ static void test_write10_F2r( const float& val )
si.id = 2008;
si.node = conf->getLocalNode();
IOController_i::CalibrateInfo cal = ui->getCalibrateInfo(si);
float fval = (float)ui->getValue(si.id) / pow10(cal.precision);
float fval = (float)ui->getValue(si.id) / pow(10.0, cal.precision);
REQUIRE( fval == val );
}
......@@ -729,7 +729,7 @@ static void test_write10_F4prec( const float& val )
si.id = 2009;
si.node = conf->getLocalNode();
IOController_i::CalibrateInfo cal = ui->getCalibrateInfo(si);
float fval = (float)ui->getValue(si.id) / pow10(cal.precision);
float fval = (float)ui->getValue(si.id) / pow(10.0, cal.precision);
REQUIRE( fval == val );
}
......
......@@ -14,6 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// -------------------------------------------------------------------------
#include <cmath>
#include "Configuration.h"
#include "Extensions.h"
#include "UniSetTypes.h"
......@@ -247,7 +248,7 @@ namespace uniset
}
if( !it->noprecision && it->cal.precision != 0 )
val = lround( val * pow10(it->cal.precision) );
val = lround( val * pow(10.0, it->cal.precision) );
}
} // end of 'check_depend'
......@@ -283,7 +284,7 @@ namespace uniset
memcpy(&val, &fval, std::min(sizeof(val), sizeof(fval)));
}
else if( it->cal.precision != 0 && !it->noprecision )
val = lroundf( fval * pow10(it->cal.precision) );
val = lroundf( fval * pow(10.0, it->cal.precision) );
// проверка на обрыв
if( it->check_channel_break(val) )
......@@ -395,7 +396,7 @@ namespace uniset
{
// сперва "убираем степень", потом калибруем.. (это обратная последовательность для AsAI)
if( !it->noprecision && it->cal.precision != 0 )
val = lroundf( (float)it->value / pow10(it->cal.precision) );
val = lroundf( (float)it->value / pow(10.0, it->cal.precision) );
IOController_i::CalibrateInfo* cal( &(it->cal) );
......@@ -461,7 +462,7 @@ namespace uniset
}
if( !it->noprecision && it->cal.precision != 0 )
return ( fval / pow10(it->cal.precision) );
return ( fval / pow(10.0, it->cal.precision) );
}
else // if( it->stype == UniversalIO::DI || it->stype == UniversalIO::DO )
fval = val ? 1.0 : 0.0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment