| 60 | |
| 61 | |
| 62 | static double convertToFloating(long long fixedValue) |
| 63 | { |
| 64 | // NOTE: We do the conversion from fixed point via integer division |
| 65 | // and then modulus, rather than a single floating point division. |
| 66 | // This ensures that we only apply floating point division to inputs |
| 67 | // in the range [0,999], which is easier to check for correctness. |
| 68 | double quotient = static_cast<double>(fixedValue / 1000); |
| 69 | double remainder = static_cast<double>(fixedValue % 1000) / 1000.0; |
| 70 | |
| 71 | return quotient + remainder; |
| 72 | } |
| 73 | |
| 74 | |
| 75 | ostream& operator<<(ostream& stream, const Value::Scalar& scalar) |