Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
KISS MY ASCII GOOD PI!
#6
(08-22-2022, 03:49 PM)Pete Wrote: Hey, I did better than Mark (bplus), because I recognized one word... Damit. Well damn it, I never knew that was a German word!

Well my mad math skills are 40 years behind me, so that example is lost on me in present time, damit.

Pete

You enjoy math: It could be this formula conversion (photo), but I'm not sure.
Maybe I'll try to implement this in Basic.

Do you know what "gift" means in German?   Tongue

Code: (Select All)
void effektivZins( double nominal_zins, double kurs, double p_annu, int t_frei )
{
    int x, tz;
    double AZ, Co, q, t, n;
    double p, pi, g, r, rl;
    double fk1, fk2, fg1, fg2, pa;
    double pd1, pd2, qi1, qi2;
    double C1, C2, dy;
    char puffer[64];   //AZ=Abschluázahlung
                                       //Co=Ausgabekurs
                                       //p=Nominalzins
                                       //pi=Effektivzins
                                       //q=Aufzinsfaktor, q=1+i
                                       //fg=nachsch. Rentenbarwertfaktor
                                       //fk, fk2=Hilfsvariablen
                                       //r=Laufzeit
                                       //g=ganzzahliger Teil der Laufzeit
                                       //rl=restl. Laufzeit
                                       //t=Tilgungssatz
                                       //n=g+1
                                       //pa=Prozentannuit„t
                                       //pd1,2 qi1,2 C1,2 dy=Hilfsvariable

    
    printf( "\nDie Effektivverzinsung der Annuitaetenschuld mit %d tilgungsfreien ", t_frei);    
    printf( "Jahr(en) \nbetraegt : " );
    
    p = nominal_zins;
    pa = p_annu;
    tz = t_frei;
    Co = kurs;
    //------------------------------------
    q = 1 + (p / 100);
    t = pa - p;            //Tilgungssatz

    //Laufzeit (6-31) S.228
    r = (log(pa) - log(t)) / log(q);

    x = 1;
    //... und ganzzahlige Tilgungsdauer ermitteln
    rl = fmod(r, x);
    g = r - rl;

    //** Effektivzins bei P.-annuität mit tilgungsfreier Zeit S.232(77) **
    //====================================================================

    //Abschlußzahlung (6-30) und S.228
    AZ = ((100 * pow(q, g)) - (pa * ((pow(q, g) - 1) / (q - 1)))) * q;

    //Laufzeit mit Abschluázahlung S.230 unten
    n = g + 1;

    //Effektivzins nach Nährungsformel (6-7)  "Faustformel"
    pi = ((p + ((100 - Co) / n)) / Co) * 100;

    x = 1;
    //Zwei Zinsätze fr C1 und C2 ermitteln
    dy = fmod(pi, x);     //Nachkommarest ermitteln

    //Bandbreite der Zinss„tze z.B.: pi=7.2 -->  pd1=7.0 -- pd2=7.5
    if ( dy > 0.5 )
    {
        pd1 = pi - (dy / 2);
        pd2 = pi + (dy / 2);
    }
    else
    {
        pd1 = pi - dy;
        pd2 = pi + dy + 0.1;
    }
    //Effekt.- Aufzinsfaktoren der beiden Zinss„tze fr C1, C2 bestimmen
    qi1 = 1 + (pd1 / 100);
    qi2 = 1 + (pd2 / 100);

    //** Jeweils 2 (fk,fg) und nach! den Eff.-aufzinsfaktoren **

    //'fk' (6-32), wie nachschüssiger Rentenbarwertfaktor (6-18) S.215
    fk1 = (1 / pow(qi1, tz)) * ((pow(qi1, tz) - 1) / (qi1 - 1));
    fk2 = (1 / pow(qi2, tz)) * ((pow(qi2, tz) - 1) / (qi2 - 1));

    //'fg'(6-32), wie oben
    fg1 = (1 / pow(qi1, g)) * ((pow(qi1, g) - 1) / (qi1 - 1));
    fg2 = (1 / pow(qi2, g)) * ((pow(qi2, g) - 1) / (qi2 - 1));

    //Ausgabekurs (6-34) S.230, fr beide Zinss„tze
    C1 = p * fk1 + ((pa * fg1 + (AZ * (1 / pow(qi1, n)))) * (1 / pow(qi1, tz)));
    C2 = p * fk2 + ((pa * fg2 + (AZ * (1 / pow(qi2, n)))) * (1 / pow(qi2, tz)));

    //Eff.-zins Nährungslösung durch lineare Interpolation (Kopie S.642)
    pi = pd1 + ((pd2 - pd1) * ((C1 - Co) / (C1 - C2)));

    printf( "%7.5f", pi);    
    printf( " %%\n" );
    //getch();
}
Reply


Messages In This Thread
KISS MY ASCII GOOD PI! - by Pete - 08-22-2022, 09:43 AM
RE: KISS MY ASCII GOOD PI! - by Kernelpanic - 08-22-2022, 12:23 PM
RE: KISS MY ASCII GOOD PI! - by Pete - 08-22-2022, 02:25 PM
RE: KISS MY ASCII GOOD PI! - by Kernelpanic - 08-22-2022, 03:37 PM
RE: KISS MY ASCII GOOD PI! - by Pete - 08-22-2022, 03:49 PM
RE: KISS MY ASCII GOOD PI! - by Kernelpanic - 08-22-2022, 03:57 PM
RE: KISS MY ASCII GOOD PI! - by Pete - 08-22-2022, 06:37 PM
RE: KISS MY ASCII GOOD PI! - by Kernelpanic - 08-22-2022, 09:17 PM
RE: KISS MY ASCII GOOD PI! - by Kernelpanic - 08-22-2022, 10:42 PM
RE: KISS MY ASCII GOOD PI! - by SMcNeill - 08-22-2022, 10:56 PM
RE: KISS MY ASCII GOOD PI! - by Pete - 08-24-2022, 12:28 AM
RE: KISS MY ASCII GOOD PI! - by Jack - 08-22-2022, 11:44 PM
RE: KISS MY ASCII GOOD PI! - by SMcNeill - 08-22-2022, 11:51 PM
RE: KISS MY ASCII GOOD PI! - by Jack - 08-24-2022, 01:27 AM
RE: KISS MY ASCII GOOD PI! - by Jack - 08-24-2022, 02:20 AM
RE: KISS MY ASCII GOOD PI! - by Pete - 08-25-2022, 02:06 AM
RE: KISS MY ASCII GOOD PI! - by Jack - 08-25-2022, 11:43 AM
RE: KISS MY ASCII GOOD PI! - by Pete - 08-25-2022, 08:50 PM
RE: KISS MY ASCII GOOD PI! - by Kernelpanic - 08-25-2022, 04:41 PM
RE: KISS MY ASCII GOOD PI! - by mnrvovrfc - 08-25-2022, 08:12 PM
RE: KISS MY ASCII GOOD PI! - by Kernelpanic - 08-25-2022, 09:37 PM
RE: KISS MY ASCII GOOD PI! - by Jack - 08-26-2022, 12:50 AM
RE: KISS MY ASCII GOOD PI! - by Pete - 08-26-2022, 03:16 AM
RE: KISS MY ASCII GOOD PI! - by Pete - 08-26-2022, 03:39 PM
RE: KISS MY ASCII GOOD PI! - by Pete - 08-26-2022, 04:14 PM
RE: KISS MY ASCII GOOD PI! - by Jack - 08-26-2022, 04:24 PM
RE: KISS MY ASCII GOOD PI! - by Pete - 08-26-2022, 04:46 PM
RE: KISS MY ASCII GOOD PI! - by Jack - 08-26-2022, 05:31 PM
RE: KISS MY ASCII GOOD PI! - by Pete - 08-26-2022, 07:50 PM
RE: KISS MY ASCII GOOD PI! - by Pete - 08-26-2022, 08:36 PM
RE: KISS MY ASCII GOOD PI! - by Jack - 08-26-2022, 08:48 PM
RE: KISS MY ASCII GOOD PI! - by Pete - 08-26-2022, 09:36 PM
RE: KISS MY ASCII GOOD PI! - by Pete - 08-27-2022, 05:24 AM



Users browsing this thread: 7 Guest(s)