Comment 7 for bug 264345

Revision history for this message
Fournier Frédéric (frederic31-fournier) wrote : Re: [Bug 264345] Re: =(-8)^(1/3) algo floating...

Here is an algorithm that gives you the smallest denominator of a floating number written in the form of fraction.
with that you can solve the problem even if in the calculation of x ^
(n / m), n / m is transformed into a floating because you can
find something iteration.

I use that frac referrals factionnaire part of a number:
frac(1.255)=0.255;

is a recursive function:

function d=donominateur(x)
  if (frac(x)>-0.000001 and frac(x)<0.000001)
     then d=1/x;
  else d=1/x*donominateur(1/x);
end if
end function

I have one. ods of this algorithm to show that the algorithm works, we
can show mathematically a recurrence but is a long time.
The only flaw of this algorithm is the accuracy of the test: "frac
(x)>-esp and frac (x) <eps." the accuracy of x must be less than esp.
I just send this. Ods on the list if you want?

Le mercredi 03 septembre 2008 à 16:04 +0000, Martin Kretzschmar a écrit :
> I'm not an expert on computer arithmetic, but I would guess that this
> can only be solved using symbolic algebra, or by storing rational
> numbers as rationals, or by using complex arithmetic. Openoffice.org
> most likely uses plain floating point arithmetic, so cannot solve
> this.
>