| 684 | } |
| 685 | |
| 686 | double Value::toDouble() const noexcept { |
| 687 | switch (getType()) { |
| 688 | case ValueType::Double: |
| 689 | return _data.d; |
| 690 | case ValueType::InternedString: |
| 691 | case ValueType::StaticString: |
| 692 | return atof(toStringBox().getCStr()); // NOLINT(cert-err34-c) |
| 693 | default: |
| 694 | return static_cast<double>(toLong()); |
| 695 | } |
| 696 | } |
| 697 | |
| 698 | float Value::toFloat() const noexcept { |
| 699 | return static_cast<float>(toDouble()); |
no test coverage detected