Sorry, der Code ging gerade nicht so raus wie ich es mir dachte:

sub testfraction
   Dec = 1.15
   Basis = 0.001
   iNum = 0
   iDenom = 1
   Negative = 1
   If Dec < 0 Then Negative = -1
    Fraction = 0
    While Abs(Fraction - Dec) > Basis
       If Abs(Fraction) > Abs(Dec) Then
           iDenom = iDenom + 1
       Else
           iNum = iNum + Negative
       End If
               Fraction = iNum / iDenom
   Wend
   msgbox  iNum
   msgbox  iDenom
end sub

Michael Dannenhöfer schrieb:


[EMAIL PROTECTED] schrieb:
Hallo Newsgroup,
wie isoliere ich in Calc aus einer Kommazahl den Integer- oder Fraction-anteil.
Gruß, Werner.



Es gibt dafür keine eigene Formel. Du kannst aber eigene Funktioen mit Starbasic schreiben.
Als Bais dafür könnte die das weiterhelfen:

sub testfraction
Dec = 1.15 Basis = 0.001 iNum = 0 iDenom = 1 Negative = 1 If Dec < 0 Then Negative = -1 Fraction = 0 While Abs(Fraction - Dec) > Basis If Abs(Fraction) > Abs(Dec) Then iDenom = iDenom + 1 Else iNum = iNum + Negative End If
       Fraction = iNum / iDenom      Wend
   msgbox  iNum
   msgbox  iDenom
end sub mfg
Michael
mfg
Michael


--
FAQ zu Starbasic -> http://www.starbasicfaq.de
Volltextsuche in SO/OOo -> http://www.dannenhoefer.de/down
music.funplayer Datenbank/Player -> http://www.dannenhoefer.de/funplayer
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Antwort per Email an