Changeset 179:34ddda735cf1 in finroc_plugins_data_ports


Ignore:
Timestamp:
23.04.2021 13:05:26 (8 months ago)
Author:
Max Reichardt <max.reichardt@…>
Branch:
17.03
Phase:
public
Message:

Fixes == operator of tNumber for 32 bit float values

File:
1 edited

Legend:

Unmodified
Added
Removed
  • numeric/tNumber.h

    r173 r179  
    152152  bool operator==(const tNumber& other) const 
    153153  { 
    154     return integer_value == other.integer_value && number_type == other.number_type; 
     154    static_assert(sizeof(integer_value) == sizeof(double_value), "Implementation needs to be improved for this case"); 
     155    return number_type == other.number_type && (number_type == tType::FLOAT ? (float_value == other.float_value) : (integer_value == other.integer_value)); 
    155156  } 
    156157 
Note: See TracChangeset for help on using the changeset viewer.