MCPcopy Create free account
hub / github.com/apache/arrow / scaled_float

Function scaled_float

python/pyarrow/tests/test_compute.py:2337–2345  ·  view source on GitHub ↗

Return a float representation (possibly approximate) of `int_val**-scale`

(int_val, scale)

Source from the content-addressed store, hash-verified

2335
2336
2337def scaled_float(int_val, scale):
2338 """
2339 Return a float representation (possibly approximate) of `int_val**-scale`
2340 """
2341 assert isinstance(int_val, int)
2342 unscaled = decimal.Decimal(int_val)
2343 scaled = unscaled.scaleb(-scale)
2344 float_val = float(scaled)
2345 return float_val
2346
2347
2348def integral_float_to_decimal_cast_cases(float_ty, max_precision):

Callers 1

Calls 1

DecimalMethod · 0.45

Tested by

no test coverage detected