| 386 | } |
| 387 | |
| 388 | std::optional<float> FloatingDecimal::toFloatFromValue( |
| 389 | int128_t value, |
| 390 | int32_t scale) { |
| 391 | float sign = 1; |
| 392 | if (value < 0) { |
| 393 | value = -value; |
| 394 | sign = -1; |
| 395 | } |
| 396 | int32_t nDigits = 0; |
| 397 | std::string valueStr = valueToString(value, scale, nDigits); |
| 398 | int32_t decExponent = nDigits - scale; |
| 399 | auto res = floatValue(valueStr, nDigits, decExponent); |
| 400 | if (res.has_value()) { |
| 401 | return *res * sign; |
| 402 | } |
| 403 | return {}; |
| 404 | } |
| 405 | |
| 406 | std::optional<float> FloatingDecimal::floatValue( |
| 407 | std::string& value, |
nothing calls this directly
no test coverage detected