|
Boost : |
From: Neal D. Becker (nbecker_at_[hidden])
Date: 2003-12-15 07:44:05
On Saturday 13 December 2003 11:40 am, Mohamed Iqbal wrote:
> > 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.
>
The fact that some operators might or might not be usefully defined on
complex<int> is no reason to reject the concept of supporting complex<int>.
I think the solution is to just leave these as implementation dependent.
I can supply useful definitions for all of these for my own work.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk