Boost logo

Boost :

From: Mohamed Iqbal (miqbal_at_[hidden])
Date: 2003-12-13 11:40:42

> Mohamed Iqbal wrote:
> >>>26.2/2: The effect of instantiating the template complex for any type
> >>> other than float, double or long double is unspecified.
> >>>
> >>Does anybody know the reason for that?
> >
> > Another reason is: some of the mathematical operations are not
meaningful if
> > you can't
> > represent a fractional value.
> can you give examples for that. which basic operations make sense with
> int but not with complex<int>?

It's the reverse. There is a number of mathematical operations available
on complex that doesn't make sense with int.

pow, cos, sin, sqrt, tan, polar, ...

sin and cos returns a result in the -1..1 range. An integer can only
store, -1,0,1 which obvisoulsy means you can only process the angles 0,
90, 180, 270.

A complex number is by mathematical definition a superset of a floating
point number, containing a real and an imaginary part (each a floating
point number) so obviously you can't use two integers.


Boost list run by bdawes at, gregod at, cpdaniel at, john at