[Webkit-unassigned] [Bug 34538] audio engine: add Complex number class

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Feb 3 13:21:52 PST 2010


https://bugs.webkit.org/show_bug.cgi?id=34538





--- Comment #4 from Darin Adler <darin at apple.com>  2010-02-03 13:21:52 PST ---
(From update of attachment 48062)
> +    Complex() : m_real(0.0), m_imag(0.0) { }

We try to keep abbreviations to a minimum in WebKit and use words instead. So
this would normally be called "imaginary", not "imag".

> +    double abs() const { return sqrt(m_real*m_real + m_imag*m_imag); }

We put spaces around operators like "*".

> +    double magnitude() const { return abs(); }

Do we really need both the names "abs()" and "magnitude()"? How about choosing
just one? I suggest "magnitude".

> +    void setMagnitudePhase(double mag, double phase)
> +    {
> +        m_real = mag * cos(phase);
> +        m_imag = mag * sin(phase);
> +    }

It seems like we'd want this to be a function that returns a Complex, rather
than a setter.

> +protected:
> +    double m_real;
> +    double m_imag;

private, not protected.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list