MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / mantexp_values

Function mantexp_values

benchmarks/audit/run_sympy.py:74–87  ·  view source on GitHub ↗
(res)

Source from the content-addressed store, hash-verified

72
73
74def mantexp_values(res):
75 # [mant_re, exp_re, mant_im, exp_im] with v = mant·10^exp, |mant| ∈ [1,10)
76 # — grades exact constants whose components exceed float64 range.
77 out = []
78 re_, im_ = res.as_real_imag()
79 for v in (re_, im_):
80 r = Rational(v)
81 f = mpmath.mpf(r.p) / mpmath.mpf(r.q)
82 if f == 0:
83 out += [0.0, 0.0]
84 else:
85 e = int(mpmath.floor(mpmath.log10(abs(f))))
86 out += [float(f / mpmath.power(10, e)), float(e)]
87 return out
88
89
90for c in SUITE["cases"]:

Callers 1

run_sympy.pyFile · 0.85

Calls 3

powerMethod · 0.80
absFunction · 0.50
floorMethod · 0.45

Tested by

no test coverage detected