MCPcopy Index your code
hub / github.com/numpy/numpy / as_real

Function as_real

numpy/f2py/symbolic.py:973–985  ·  view source on GitHub ↗

Return object as REAL constant.

(obj, kind=4)

Source from the content-addressed store, hash-verified

971
972
973def as_real(obj, kind=4):
974 """Return object as REAL constant.
975 """
976 if isinstance(obj, int):
977 return Expr(Op.REAL, (float(obj), kind))
978 if isinstance(obj, float):
979 return Expr(Op.REAL, (obj, kind))
980 if isinstance(obj, Expr):
981 if obj.op is Op.REAL:
982 return obj
983 elif obj.op is Op.INTEGER:
984 return Expr(Op.REAL, (float(obj.data[0]), kind))
985 raise OpError(f'cannot convert {obj} to REAL constant')
986
987
988def as_string(obj, kind=1):

Callers 5

__add__Method · 0.85
__mul__Method · 0.85
as_termsFunction · 0.85
as_term_coeffFunction · 0.85
processMethod · 0.85

Calls 2

ExprClass · 0.85
OpErrorClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…