home *** CD-ROM | disk | FTP | other *** search
- package srd.math;
-
- class ComplexNumber {
- private double m_dReal;
- private double m_dImag;
-
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append('(').append(this.m_dReal).append(',');
- sb.append(this.m_dImag).append(')');
- return sb.toString();
- }
-
- public ComplexNumber(double dR, double dI) {
- this.m_dReal = dR;
- this.m_dImag = dI;
- }
-
- public ComplexNumber(double dR) {
- this(dR, (double)0.0F);
- }
-
- public ComplexNumber Divide(double d) throws Exception {
- if (d == (double)0.0F) {
- throw new Exception("Attempted divide by zero in ComplexNumber.divide");
- } else {
- return new ComplexNumber(this.m_dReal / d, this.m_dImag / d);
- }
- }
- }
-