(value: float, type_id: int)
| 194 | |
| 195 | |
| 196 | def _to_float_domain(value: float, type_id: int) -> float: |
| 197 | if type_id == TypeId.FLOAT64: |
| 198 | return float(value) |
| 199 | if type_id == TypeId.FLOAT32: |
| 200 | return _to_float32(value) |
| 201 | if type_id == TypeId.FLOAT16: |
| 202 | return _float16_from_bits(_float16_to_bits(value)) |
| 203 | if type_id == TypeId.BFLOAT16: |
| 204 | return _bfloat16_from_bits(_bfloat16_to_bits(value)) |
| 205 | raise ValueError(f"type id {type_id} is not a floating type") |
| 206 | |
| 207 | |
| 208 | def _decimal_from_float_value(value: float) -> decimal.Decimal: |
no test coverage detected