On Mon, Aug 29, 2011 at 1:47 AM, Dave Abrahams <dave@boostpro.com> wrote:

on Mon Aug 29 2011, alfC <alfredo.correa-AT-gmail.com> wrote:

> On Monday, August 29, 2011 1:02:00 AM UTC-7, John Maddock wrote:
>
>     evaluate a polynomial approximation to the function:
>
>     To consider a trivial example, if T*T isn't a T, then one can't even
>
>     result = A + B* T + C * T^2 + D * T^3...
>
>     to give a concrete example, the root finding algorithm that started this
>     thread uses a polynomial approximation to the function to greatly speed up
>     finding the root (we can find the polynomial approximation and it's root
>     algebraically once we have evaluated enough points in the function).  It's
>     this insight that makes the algorithm converge so rapidly compared to the
>     alternatives, but requiring that T*T != T breaks the underlying assumptions
>     not only in how it's implemented, but in how it actually works
>     algorithmically.
>
> The easy answer is that A, B, C and D are different types then.
> the types of A, B, C and D can be deduced from the type of T and the type of the result R, which are know at that
> point.

I think (and John can correct me if I'm mistaken) that the problem is
that it's an iterative algorithm (and even if it isn't, you can imagine
it is; many such functions are iterative).  You have to go through that
calculation a number of times that can only be known at runtime, each
time feeding the last result back into the input, until it converges.
So how do you know what the result type should be?  At compile-time, you
don't!  And even if you could declare it, would it be meaningful?

Anything you can do with reals you can do with quantities, of course.
*Additionally* I can't imagine an *useful* iterative process that generates and unlimited number of different dimensional quantities (i.e. and unlimited number of compile time types).
Definitely root finding at most uses the domain type, the result type and a small number of types associated with fractions of result type over domain type to a integer power.

That is, T, R, R/T, R/T^2, R/T^3, at most.

In the particular case that R=double, T=double, everything ends up being a double.

Alfredo