MCPcopy Create free account
hub / github.com/apache/fory / _to_float_domain

Function _to_float_domain

python/pyfory/converter.py:196–205  ·  view source on GitHub ↗
(value: float, type_id: int)

Source from the content-addressed store, hash-verified

194
195
196def _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
208def _decimal_from_float_value(value: float) -> decimal.Decimal:

Callers 2

_float_valueFunction · 0.85
_numeric_valueFunction · 0.85

Calls 1

_to_float32Function · 0.85

Tested by

no test coverage detected