       else if Array.isArray a and Array.isArray b
         if a.length != b.length
           throw "Cannot perform operation with arrays of different lengths"
-        numbersOnly = true
-        for i in [0...a.length]
-          if typeof a[i] != 'number' or typeof b[i] != 'number'
-            numbersOnly = false
-            break
-        if numbersOnly
+        if (isArrayType a, 'number') and (isArrayType b, 'number')
           (Math.max a[i], b[i]) for i in [0...a.length]
         else 
           "max(vec3(#{a}), vec3(#{b}))"

          when 0 then 0
          else 
            # Number must not be integers (bitwise op converts operand to integer)
            "#{if (a | 0) == a then (a + '.0') else a} / #{b}"
      else if typeof b == 'number'
        switch b
          when 0 then "#{a} / 0.0" # infinity
          else 
            # Number must not be integers (bitwise op converts operand to integer)
            "#{a} / #{if (b | 0) == b then (b + '.0') else b}"
      else 
        "#{a} / #{b}"
      # TODO: handle vectors

      else if Array.isArray a and Array.isArray b
        if a.length != b.length
          throw "Cannot perform operation with arrays of different lengths"
        if (isArrayType a, 'number') and (isArrayType b, 'number')
          (Math.max a[i], b[i]) for i in [0...a.length]
        else 
          "max(#{glsl.vec3Lit a}, #{glsl.vec3Lit b})"
