| 18 | |
| 19 | |
| 20 | class FLE: public Printable |
| 21 | { |
| 22 | public: |
| 23 | // CONSTRUCTOR |
| 24 | FLE(float val = 0, float error = 0); |
| 25 | |
| 26 | // PRINTABLE |
| 27 | size_t printTo(Print& p) const; |
| 28 | FLE setDecimals(uint8_t n) { _decimals = n; return *this; }; |
| 29 | FLE setSeparator(char c) { _sep = c; return *this; }; |
| 30 | |
| 31 | // BASE FUNCTIONS |
| 32 | float value() const{ return _v; }; |
| 33 | float error() const{ return _e; }; |
| 34 | float relError() const{ return (_v == 0 ? 0 : abs(_e / _v)); }; |
| 35 | float high() const{ return _v + _e; }; |
| 36 | float low() const{ return _v - _e; }; |
| 37 | |
| 38 | // MATH OPERATORS |
| 39 | FLE operator - (); // negation c = -a; |
| 40 | |
| 41 | FLE operator + (const FLE&); |
| 42 | FLE operator - (const FLE&); // minus c = a - b; |
| 43 | FLE operator * (const FLE&); |
| 44 | FLE operator / (const FLE&); |
| 45 | FLE operator += (const FLE&); |
| 46 | FLE operator -= (const FLE&); |
| 47 | FLE operator *= (const FLE&); |
| 48 | FLE operator /= (const FLE&); |
| 49 | |
| 50 | |
| 51 | // BOOL OPERATORS |
| 52 | // for all value pairs of a and b |
| 53 | bool operator == (const FLE&); |
| 54 | // bool operator == (const FLE); |
| 55 | bool operator != (const FLE&); |
| 56 | bool operator > (const FLE&); |
| 57 | bool operator < (const FLE&); |
| 58 | |
| 59 | |
| 60 | // MISC OPERATORS |
| 61 | // FLE lies completely in range a |
| 62 | // meaning FLE is more precise than a => smaller error. |
| 63 | bool in(FLE a); |
| 64 | // returns overlap == common part, or FLE(NAN, NAN) otherwise |
| 65 | FLE shared(FLE a); |
| 66 | FLE lower(FLE a); // part of this lower than a; |
| 67 | FLE higher(FLE a); // part of this higher than a; |
| 68 | |
| 69 | |
| 70 | // EXPERIMENTAL - INVESTIGATE |
| 71 | // weak propositions. |
| 72 | bool peq (const FLE& a); // possible equal |
| 73 | bool pne (const FLE& a); // possible not equal |
| 74 | bool plt (const FLE& a); // possible less than |
| 75 | bool ple (const FLE& a); // possible less equal |
| 76 | bool pgt (const FLE& a); // possible greater than |
| 77 | bool pge (const FLE& a); // possible greater equal |
no outgoing calls
no test coverage detected