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

Function scaled_float

python/pyarrow/tests/test_compute.py:2174–2182  ·  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

2172
2173
2174def scaled_float(int_val, scale):
2175 """
2176 Return a float representation (possibly approximate) of `int_val**-scale`
2177 """
2178 assert isinstance(int_val, int)
2179 unscaled = decimal.Decimal(int_val)
2180 scaled = unscaled.scaleb(-scale)
2181 float_val = float(scaled)
2182 return float_val
2183
2184
2185def integral_float_to_decimal_cast_cases(float_ty, max_precision):

Callers 1

Calls 1

DecimalMethod · 0.45

Tested by

no test coverage detected