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

--- Comment #5 from mewa...@gmail.com ---
fwiw, in Excel, although -2^(0.333333) gives an error, -2^(0.333333333333333)
does not (and -2^(n/y) is also an error if n is > 1, even if 1/y works fine). 

Possibly the Excel pow() evaluator is simply checking its argument to see if it
is the equivalent to 1/y where y is an odd number. this exception-based
approach would not be hard to implement in POI-- it would not need to impact
the interpreter, and would just be a change to the pow() code such as the
following, with the appropriate type used in lieu of "double":

  function pow(x, y) {
    if(abs(y) < 1) {
      double one_over = abs(1/y);
      // change .001 to smallest possible val that still gives correct result
      int yth_root = (int)round(one_over, 0);
      if(abs(round(one_over, 0) - one_over) < .001) {
        double exact_1_over_y = (double)1/(double)yth_root;
        if(y == exact_1_over_y) { // y = 1/n or the exact decimal equivalent
          // find the yth root and return that
          ...
  ...

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

Reply via email to