You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2018/01/23 21:02:13 UTC

[Bug 62040] New: Quotient.evaluate function does not accept cell refences

https://bz.apache.org/bugzilla/show_bug.cgi?id=62040

            Bug ID: 62040
           Summary: Quotient.evaluate function does not accept cell
                    refences
           Product: POI
           Version: 3.17-FINAL
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: SS Common
          Assignee: dev@poi.apache.org
          Reporter: cquezel@gmail.com
  Target Milestone: ---

I think adding OperandResolver.getSingleValue for the numerator and denominator
might solvce the problem.


    @Override
        public ValueEval evaluate(int srcRowIndex, int srcColumnIndex,
ValueEval venumerator, ValueEval vedenominator) {

        double enumerator = 0;
        try {
                        ValueEval ve =
OperandResolver.getSingleValue(venumerator, srcRowIndex, srcColumnIndex); //
added this line
            enumerator = OperandResolver.coerceValueToDouble(ve);
        } catch (EvaluationException e) {
            return ErrorEval.VALUE_INVALID;
        }

        double denominator = 0;
        try {
                        ValueEval ve =
OperandResolver.getSingleValue(vedenominator, srcRowIndex, srcColumnIndex); //
added this line
            denominator = OperandResolver.coerceValueToDouble(ve);
        } catch (EvaluationException e) {
            return ErrorEval.VALUE_INVALID;
        }

        if (denominator == 0) {
            return ErrorEval.DIV_ZERO;
        }

        return new NumberEval((int)(enumerator / denominator));
    }

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62040] Quotient.evaluate function does not accept cell refences

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62040

--- Comment #3 from Dominik Stadler <do...@gmx.at> ---
That would be perfekt!

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62040] Quotient.evaluate function does not accept cell refences

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62040

--- Comment #6 from Ian Giguère <ia...@cybercat.ca> ---
Created attachment 36530
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36530&action=edit
Edited Excel file: QuotientFunctionTestCaseData.xls

Add new line to 'QuotientFunctionTestCaseData.xls' to test QUOTIENT with cell
references as arguments.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62040] Quotient.evaluate function does not accept cell refences

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62040

--- Comment #2 from cquezel@gmail.com ---
(In reply to Dominik Stadler from comment #1)
> Do you have a code-sample that shows the problem? Ideally a self-standing
> unit-test? Would make it much easier to reproduce and ensure it stays fixed
> in the future.

I'm not at all familiar with your testing methods. What I did was load an Excel
spreadsheet evaluate it and compare the results visually and with poi. I could
write a simple Excel file and the POI unit test to show fail on the error. Is
that OK?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62040] Quotient.evaluate function does not accept cell refences

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62040

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
Do you have a code-sample that shows the problem? Ideally a self-standing
unit-test? Would make it much easier to reproduce and ensure it stays fixed in
the future.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62040] Quotient.evaluate function does not accept cell refences

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62040

Ian Giguère <ia...@cybercat.ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #8 from Ian Giguère <ia...@cybercat.ca> ---
I did not know if the patch file was sufficient so I also added the excel and
java files I edited.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62040] Quotient.evaluate function does not accept cell refences

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62040

--- Comment #4 from Dominik Stadler <do...@gmx.at> ---
Any update on the sample file and unit-test?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62040] Quotient.evaluate function does not accept cell refences

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62040

PJ Fanning <fa...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #9 from PJ Fanning <fa...@yahoo.com> ---
fix applied with r1894103

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62040] Quotient.evaluate function does not accept cell refences

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62040

--- Comment #7 from Ian Giguère <ia...@cybercat.ca> ---
Created attachment 36531
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36531&action=edit
Modifications to Quotient.java to support cell references

Dereference Value before coercing it to double.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 62040] Quotient.evaluate function does not accept cell refences

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62040

Ian Giguère <ia...@cybercat.ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ian@cybercat.ca

--- Comment #5 from Ian Giguère <ia...@cybercat.ca> ---
Created attachment 36529
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=36529&action=edit
Modifications to Quotient.java and QuotientFunctionTestCaseData.xls

Add new line to 'QuotientFunctionTestCaseData.xls' to test QUOTIENT with cell
references as arguments.

Dereference Value before coercing it to double.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org