Boost logo

Boost :

From: Dan W. (danw_at_[hidden])
Date: 2004-01-09 05:33:20


Andy Little wrote:
>> Impedance == "complex resistance".
>
>
> I have always had problems with complex numbers... whats so 'complex'?
> Also have problems with analogue electonics.
>
> Hows about :
>
> std::complex<q_impedance::R> =
> std::complex<q_voltage::V>()/std::complex<q_voltage::I>().
> No idea if that would actually work though.... Anybody ...?

"std::complex<q_imp..." that's cheating! :) No, seriously, I don't mind
if you make value type the last template parameter and default it to
double; but you can't just dictate that it must be double. What about if
someone needs long double (80-bits)? And what's so difficult about it?
  Instead of applying your operators + - * / to 'double', you apply them
to 'V'. That's all! And when someone complains of a precision or
rounding problem in converting between value types, you can shift the
blame to the maintainers of numerics... :)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk