 
 /********************************************************************/
 /****                                                            ****/
 /****                                                            ****/
 /****    Program          : MatheFunktionen                      ****/
 /****                                                            ****/
 /****    Version          :    01.07                             ****/
 /****                                                            ****/
 /****    Erstversion      : 21.05.1988                           ****/
 /****                                                            ****/
 /****    Letzte Änderung  : 31.05.1990                           ****/
 /****                                                            ****/
 /****    Compiliert mit   : siehe MAKE                           ****/
 /****                                                            ****/
 /****    Gelinkt mit      : Für Tool.Library                     ****/
 /****                                                            ****/
 /********************************************************************/
 /****                                                            ****/
 /****                                                            ****/
 /****               Copyright by Rüdiger Dreier                  ****/
 /****                                                            ****/
 /****                                                            ****/
 /********************************************************************/
 
 #include "ToolProto.h"
 #include <proto/mathieeedoubbas.h>
 #include <proto/mathieeedoubtrans.h>
 
 extern struct Library *MathIeeeDoubBasBase;
 extern struct Library *MathIeeeDoubTransBase;
 
 
 VOID __asm Fak(register __a0 DOUBLE *Ziel,
                register __d0 LONG i)
  {
   DOUBLE W2,W3;
   if(i>0)
    {
     Fak(&W2,i-1);
     W3=Flt(i);
     *Ziel=Mul(W2,W3);
    }
   else
    {
     if(i==0)
      {
       *Ziel=Flt(1);
      }
     else
      {
       *Ziel=Flt(-1);
      }
    }
  }
 
 
 VOID __asm NuK(register __a0 DOUBLE *Ziel,
                register __d0 LONG n,
                register __d1 LONG k)
  {
   DOUBLE a,b,c;
   Fak(&a,n);
   Fak(&b,k);
   Fak(&c,n-k);
   if(Cmp(a,-1.0)==0)
    {
     *Ziel=-1.0;
     return;
    }
   if(Cmp(b,-1.0)==0)
    {
     *Ziel=-1.0;
     return;
    }
   if(Cmp(c,-1.0)==0)
    {
     *Ziel=-1.0;
     return;
    }
   
   b=Mul(b,c);
   a=Div(a,b);
   *Ziel=a;
  }
 
