MCPcopy Index your code
hub / github.com/python/mypy / FloatOp

Class FloatOp

mypyc/ir/ops.py:1537–1570  ·  view source on GitHub ↗

Binary float arithmetic op (e.g., r1 = r2 + r3). These ops are low-level and are similar to the corresponding C operations (and somewhat different from Python operations). The left and right values must be floats.

Source from the content-addressed store, hash-verified

1535
1536@final
1537class FloatOp(RegisterOp):
1538 """Binary float arithmetic op (e.g., r1 = r2 + r3).
1539
1540 These ops are low-level and are similar to the corresponding C
1541 operations (and somewhat different from Python operations).
1542
1543 The left and right values must be floats.
1544 """
1545
1546 error_kind = ERR_NEVER
1547
1548 ADD: Final = 0
1549 SUB: Final = 1
1550 MUL: Final = 2
1551 DIV: Final = 3
1552 MOD: Final = 4
1553
1554 op_str: Final = {ADD: "+", SUB: "-", MUL: "*", DIV: "/", MOD: "%"}
1555
1556 def __init__(self, lhs: Value, rhs: Value, op: int, line: int = -1) -> None:
1557 super().__init__(line)
1558 self.type = float_rprimitive
1559 self.lhs = lhs
1560 self.rhs = rhs
1561 self.op = op
1562
1563 def sources(self) -> list[Value]:
1564 return [self.lhs, self.rhs]
1565
1566 def set_sources(self, new: list[Value]) -> None:
1567 self.lhs, self.rhs = new
1568
1569 def accept(self, visitor: OpVisitor[T]) -> T:
1570 return visitor.visit_float_op(self)
1571
1572
1573# We can't have this in the FloatOp class body, because of

Callers 2

float_opMethod · 0.90
float_modMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…