Uploaded image for project: 'Keikai'
  1. Keikai
  2. KEIKAI-500

unary double minus operator array arg in function transform array into number

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 5.8.0
    • None
    • None
    • Security Level: Jimmy
    • None
    • None

      Steps to Reproduce

      attached xlsx sample

      Current Result

      In 5.8.0, the formula =SUMPRODUCT(–({true; true; false})  (not an actual array, just showing the result of the LEN function in the example) has the result value "1" 

      Expected Result

      Expected value is "2" 

      Debug Information

       

      org.zkoss.poi.ss.formula.functions.OverridableFunction.evaluate(ValueEval[], int, int, boolean)
      

      calls 

      org.zkoss.poi.ss.formula.functions.Fixed1ArgFunction.evaluate(ValueEval[], int, int)

      which calls

      org.zkoss.poi.ss.formula.functions.Fixed1ArgFunction.evaluate(ValueEval[], int, int, boolean)

      with the isArrayValue boolean set to false

      This causes the resulting arg passed to the outer formula to be a  org.zkoss.poi.ss.formula.eval.NumberEval instead of the expected org.zkoss.poi.ss.formula.eval.ArrayEval

       

      Since sumproduct should apply the double minus sign conversion from boolean to int (1 or 0), the sum applied to the array should return an integer equal to the number of "true" values in the array

      Workaround

      N/A

            RaymondChao RaymondChao
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: