Commits

Armin Rigo committed e82f659

Write a test_pypy_c checking that "f ** 2" gets us just a float_mul
operation. (Needs to check if the test really passes or if we
are getting a few extra stuff too.)

  • Participants
  • Parent commits f1fb181

Comments (0)

Files changed (1)

File pypy/module/pypyjit/test_pypy_c/test_math.py

             --TICK--
             jump(..., descr=)
         """)
+
+    def test_pow_two(self):
+        def main(n):
+            s = 0.123
+            while n > 0:
+                s -= s ** 2   # ID: pow
+                n -= 1
+            return s
+        log = self.run(main, [500])
+        assert abs(log.result - main(500)) < 1e-9
+        loop, = log.loops_by_filename(self.filepath)
+        assert loop.match_by_id("pow", """
+            f2 = float_mul(f1, f1)
+            f3 = float_sub(f1, f2)
+        """)