• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/ucode/tests/custom/99_bugs/56_negative_base_exponentiation

  1 Integer exponentiation with a negative base value applied a negative
  2 sign to the result unconditionally instead of respecting the parity of
  3 the exponent, e.g. (-2) ** 2 yielded -4 and (-2) ** 0 yielded -1.
  4 
  5 -- Testcase --
  6 {%
  7         printf("%.J\n", [
  8                 (-2) ** 2,
  9                 (-2) ** 3,
 10                 (-3) ** 4,
 11                 (-2) ** 0,
 12                 (-2) ** -2,
 13                 (-2) ** -3,
 14                 (-1) ** 1000000,
 15                 (-9223372036854775807 - 1) ** 1
 16         ]);
 17 %}
 18 -- End --
 19 
 20 -- Expect stdout --
 21 [
 22         4,
 23         -8,
 24         81,
 25         1,
 26         0.25,
 27         -0.125,
 28         1,
 29         -9223372036854775808
 30 ]
 31 -- End --

This page was automatically generated by LXR 0.3.1.  •  OpenWrt