Microsoft KB Archive/87824

= Microsoft Knowledge Base =

Excel: ATP Definition: IMPRODUCT, IMDIV
Last reviewed: August 16, 1996

Article ID: Q87824

The information in this article applies to:


 * Microsoft Excel for Windows 95, version 7.0
 * Microsoft Excel for Windows, versions 4.0, 5.0
 * Microsoft Excel for the Macintosh, versions 4.0, 5.0

SUMMARY
The versions of Microsoft Excel listed above provide a set of special analysis tools called the Analysis ToolPak. This article is part of a series of articles that provide information on the underlying formulas used in the Analysis ToolPak.

This article covers the following functions:

IMPRODUCT, (Complex Number Multiplication). IMDIV, (Complex Number Division).

MORE INFORMATION
The C routine used to calculate IMPRODUCT is:

typedef struct FCOMPLEX {float r,i;} fcomplex;
 * 1) include 

fcomplex Cmul(a,b) fcomplex a,b; {

fcomplex c;    c.r=a.r*b.r-a.i*b.i;     c.i=a.i*b.r+a.r*b.i;     return c; }

The C routine used to calculate IMDIV is:

typedef struct FCOMPLEX {float r,i;} fcomplex;
 * 1) include 

fcomplex Cdiv(a,b) fcomplex a,b; {

fcomplex c;    float r,den; if (fabs(b.r) >= fabs(b.i)) { r=b.i/b.r;       den=b.r+r*b.i;        c.r=(a.r+r*a.i)/den; c.i=(a.i-r*a.r)/den; } else { r=b.r/b.i;       den=b.i+r*b.r;        c.r=(a.r*r+a.i)/den; c.i=(a.i*r-a.r)/den; }    return c; }