Hi Johnny,

Am 07.08.2011 16:55, schrieb Johnny Rosenberg:
> Am I the only one who miss a Frac() function in OpenOffice.org Basic
> and as a cell function?
> 
> I always have to use my own function, which is probably slower than a
> built in function would be:
> 
> Function Frac(Value As Double) As Double
>     Frac=Value-Fix(Value) ' Using ”Int” instead of ”Fix” doesn't work
> properly for negative values.
> End Function
> 
> For example, Frac(-12.3456789) ⇨ -0.3456789
> 
> I use Frac() all the time and I can't be the only one who need it, can I? 
> Among
> other things it's nice for separating time from time+date, even if there are
> other ways to do that.
> 
> In case there is a Frac() function after all, what's it called?

The only built-in formula that comes to my mind is
REST(Dividend;Divisor) in German. In English this should be
MOD(Dividend;Divisor). But it still has the Problem with the sign of
the Dividend.
For example:
The number in Cell B2 is 4.3459234, your formula should be =MOD(B2;1)
The number in B2 is 4.3459234, then the formula should be =MOD(B2;-1)

To overcome this you could use the built-in formula VORZEICHEN(), in
English SIGN().
 In the example:
=MOD(B2;SIGN(B2)

Not really an improvement, just another way.

Maybe it helps you anyway.

Christoph

> 
> Kind regards
> 
> Johnny Rosenberg
> ジョニー・ローゼンバーグ



-- 
-----------------------------------------------------------------
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help

Reply via email to