Re: Missing a Frac() function

Christoph Jopp <[email protected]> Mon, 08 Aug 2011 09:16:24 +0200
Newsgroups gmane.comp.openoffice.devel.api
Message-ID <[email protected]>
Am 08.08.2011 08:59, schrieb Christoph Jopp:
> Hi Johnny,
>=20
> 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=3DValue-Fix(Value) ' Using =E2=80=9DInt=E2=80=9D instead of =E2=
=80=9DFix=E2=80=9D doesn't work
>> properly for negative values.
>> End Function
>>
>> For example, Frac(-12.3456789) =E2=87=A8 -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 the=
re are
>> other ways to do that.
>>
>> In case there is a Frac() function after all, what's it called?
>=20
> 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 =3DMOD(B2;1)
> The number in B2 is 4.3459234, then the formula should be =3DMOD(B2;-1)
>=20
> To overcome this you could use the built-in formula VORZEICHEN(), in
> English SIGN().
>  In the example:


Sorry, forgot one )

> =3DMOD(B2;SIGN(B2)

=3DMOD(B2;SIGN(B2))

;-)


>=20
> Not really an improvement, just another way.
>=20
> Maybe it helps you anyway.
>=20
> Christoph
>=20
>>
>> Kind regards
>>
>> Johnny Rosenberg
>> =E3=82=B8=E3=83=A7=E3=83=8B=E3=83=BC=E3=83=BB=E3=83=AD=E3=83=BC=E3=82=BC=
=E3=83=B3=E3=83=90=E3=83=BC=E3=82=B0
>=20
>=20
>=20

--=20
-----------------------------------------------------------------
To unsubscribe send email to [email protected]
For additional commands send email to [email protected]
with Subject: help