1 While arithmetic divisions generally follow the value conversion rules 2 outlined in the "00_value_conversion" test case, a number of additional 3 constraints apply. 4 5 -- Expect stdout -- 6 Division by zero yields Infinity: 7 1 / 0 = Infinity 8 9 Division by Infinity yields zero: 10 1 / Infinity = 0 11 12 Dividing Infinity yields Infinity: 13 Infinity / 1 = Infinity 14 15 Dividing Infinity by Infinity yields NaN: 16 Infinity / Infinity = NaN 17 18 If either operand is NaN, the result is NaN: 19 1 / NaN = NaN 20 NaN / 1 = NaN 21 22 If both operands are integers, integer division is performed: 23 10 / 3 = 3 24 25 If either operand is a double, double division is performed: 26 10.0 / 3 = 3.3333333333333 27 10 / 3.0 = 3.3333333333333 28 -- End -- 29 30 -- Testcase -- 31 Division by zero yields Infinity: 32 1 / 0 = {{ 1 / 0 }} 33 34 Division by Infinity yields zero: 35 1 / Infinity = {{ 1 / Infinity }} 36 37 Dividing Infinity yields Infinity: 38 Infinity / 1 = {{ Infinity / 1 }} 39 40 Dividing Infinity by Infinity yields NaN: 41 Infinity / Infinity = {{ Infinity / Infinity }} 42 43 If either operand is NaN, the result is NaN: 44 1 / NaN = {{ 1 / NaN }} 45 NaN / 1 = {{ NaN / 1 }} 46 47 If both operands are integers, integer division is performed: 48 10 / 3 = {{ 10 / 3 }} 49 50 If either operand is a double, double division is performed: 51 10.0 / 3 = {{ 10.0 / 3 }} 52 10 / 3.0 = {{ 10 / 3.0 }} 53 -- End --
This page was automatically generated by LXR 0.3.1. • OpenWrt