Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

Commit

Permalink
Fixed float/double nan binding, binds as a nan not zero now
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuart James committed Sep 25, 2018
1 parent 18c6e0e commit fd4e389
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 44 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [0.12.2] - 2018-09-25

### Fixed

* Reverted changes to binding floats/doubles that meant they were bound as 0 when isnana() was true. They now bind correctly as a nan.

## [0.12.1] - 2018-08-28

### Fixed
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ The compatibility matrix with dependencies is as follows:

| Libhdbpp-Cassandra Version | Libray Soname | Cassandra Version | Datastax C++ Driver | Libuv |
|----------------------------|---------------|-------------------|---------------------|-------|
| 0.12.2 | 7.2.2 | 2.2.11 | 2.2.1, 2.8.1 | 1.4.2 |
| 0.12.1 | 7.2.1 | 2.2.11 | 2.2.1, 2.8.1 | 1.4.2 |
| 0.12.0 | 7.2.0 | 2.2.11 | 2.2.1, 2.8.1 | 1.4.2 |
| 0.11.0 | 7.1.0 | 2.2.11 | 2.2.1 | 1.4.2 |
Expand Down
4 changes: 2 additions & 2 deletions cmake/ReleaseVersion.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Project version
set(LIBHDBPP_CASSANDRA_VERSION_MAJOR "0")
set(LIBHDBPP_CASSANDRA_VERSION_MINOR "12")
set(LIBHDBPP_CASSANDRA_VERSION_REVISION "1")
set(LIBHDBPP_CASSANDRA_VERSION_REVISION "2")
string(TIMESTAMP LIBHDBPP_CASSANDRA_TIMESTAMP "%Y-%m-%d %H:%M:%S")

# Version the shared library
set(LIBRARY_VERSION_MAJOR 7)
set(LIBRARY_VERSION_MINOR 2)
set(LIBRARY_VERSION_PATCH 1)
set(LIBRARY_VERSION_PATCH 2)

# Create the soname string
set(LIBRARY_VERSION_STRING ${LIBRARY_VERSION_MAJOR}.${LIBRARY_VERSION_MINOR}.${LIBRARY_VERSION_PATCH})
54 changes: 12 additions & 42 deletions src/TangoEventDataBinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,17 +293,9 @@ template <>
void TangoEventDataBinder::statement_bind(CassStatement *statement, const string &bind_name, float val)
{
if (std::isnan(val))
{
/// @todo Review quiet/signalling NaN in this context
cass_statement_bind_float_by_name(statement, bind_name.c_str(), 0);

/*if(numeric_limits<float>::has_quiet_NaN(val) == true)
cass_statement_bind_float_by_name(statement, bind_name.c_str(),
numeric_limits<float>::quiet_NaN());
else
cass_statement_bind_float_by_name(statement, bind_name.c_str(),
numeric_limits<float>::signaling_NaN());*/
}
cass_statement_bind_float_by_name(statement, bind_name.c_str(), numeric_limits<float>::quiet_NaN());
else if (std::isinf(val))
cass_statement_bind_float_by_name(statement, bind_name.c_str(), numeric_limits<float>::infinity());
else
cass_statement_bind_float_by_name(statement, bind_name.c_str(), val);
}
Expand All @@ -314,16 +306,9 @@ template <>
void TangoEventDataBinder::collection_append(CassCollection *read_values_list, float val)
{
if (std::isnan(val))
{
/// @todo Review quiet/signalling NaN in this context
cass_collection_append_float(read_values_list, 0);

/*if(numeric_limits<float>::has_quiet_NaN(val) == true)
cass_collection_append_float(read_values_list, numeric_limits<float>::quiet_NaN());
else
cass_collection_append_float(read_values_list,
numeric_limits<float>::signaling_NaN());*/
}
cass_collection_append_float(read_values_list, numeric_limits<float>::quiet_NaN());
else if (std::isinf(val))
cass_collection_append_float(read_values_list, numeric_limits<float>::infinity());
else
cass_collection_append_float(read_values_list, val);
}
Expand All @@ -334,17 +319,9 @@ template <>
void TangoEventDataBinder::statement_bind(CassStatement *statement, const string &bind_name, double val)
{
if (std::isnan(val))
{
/// @todo Review quiet/signalling NaN in this context
cass_statement_bind_double_by_name(statement, bind_name.c_str(), 0);

/*if(numeric_limits<double>::has_quiet_NaN(val))
cass_statement_bind_double_by_name(statement, bind_name.c_str(),
numeric_limits<double>::quiet_NaN());
else
cass_statement_bind_double_by_name(statement, bind_name.c_str(),
numeric_limits<double>::signaling_NaN());*/
}
cass_statement_bind_double_by_name(statement, bind_name.c_str(), numeric_limits<double>::quiet_NaN());
else if (std::isinf(val))
cass_statement_bind_double_by_name(statement, bind_name.c_str(), numeric_limits<double>::infinity());
else
cass_statement_bind_double_by_name(statement, bind_name.c_str(), val);
}
Expand All @@ -355,16 +332,9 @@ template <>
void TangoEventDataBinder::collection_append(CassCollection *read_values_list, double val)
{
if (std::isnan(val))
{
/// @todo Review quiet/signalling NaN in this context
cass_collection_append_double(read_values_list, 0);

/*if(numeric_limits<double>::has_quiet_NaN(val))
cass_collection_append_double(read_values_list, numeric_limits<double>::quiet_NaN());
else
cass_collection_append_double(read_values_list,
numeric_limits<double>::signaling_NaN());*/
}
cass_collection_append_double(read_values_list, numeric_limits<double>::quiet_NaN());
else if (std::isinf(val))
cass_collection_append_double(read_values_list, numeric_limits<double>::infinity());
else
cass_collection_append_double(read_values_list, val);
}
Expand Down

0 comments on commit fd4e389

Please sign in to comment.