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

Sources/ucode/tests/custom/01_arithmetic/02_modulo

  1 The ucode language supports modulo divisions.
  2 
  3 -- Expect stdout --
  4 If both operands are integers or convertible to integers,
  5 the modulo division yields the remaining integer value:
  6 10 % 4 = 2
  7 "10" % 4 = 2
  8 10 % "4" = 2
  9 "10" % "4" = 2
 10 
 11 If either operand is a double value, the modulo operation
 12 yields the remaining value as calculated by fmod(3):
 13 10.2 % 4 = 2.2
 14 10 % 4.3 = 1.4
 15 "10.4" % 4 = 2.4
 16 -- End --
 17 
 18 -- Testcase --
 19 If both operands are integers or convertible to integers,
 20 the modulo division yields the remaining integer value:
 21 10 % 4 = {{ 10 % 4 }}
 22 "10" % 4 = {{ "10" % 4 }}
 23 10 % "4" = {{ 10 % 4 }}
 24 "10" % "4" = {{ "10" % "4" }}
 25 
 26 If either operand is a double value, the modulo operation
 27 yields the remaining value as calculated by fmod(3):
 28 10.2 % 4 = {{ 10.2 % 4 }}
 29 10 % 4.3 = {{ 10 % 4.3 }}
 30 "10.4" % 4 = {{ "10.4" % 4 }}
 31 -- End --

This page was automatically generated by LXR 0.3.1.  •  OpenWrt