[Matrix-SIG] Numeric Nits--a slightly different proposal
David J. C. Beach
beach@verinet.com
Thu, 15 Jul 1999 21:31:39 -0600
On Thu, Jul 15, 1999 at 06:33:35PM -0400, Rick White wrote:
> >An expression involving two incompatible
> >forced objects would raise an exception.
>
> I can't agree with that, though. I'm afraid that will result
> in more ugly, hard-to-read code with lots of explicit casts.
> I believe that an operation between two forced objects should
> obey the normal promotion rules, with the lower forced type
> being promoted to the higher forced type.
Yes. Then maybe there should be a ForcedForcedFloat32 which is
"stronger" (more forceful?) than a plain ol' ForcedFloat32. Doesn't
this problem just start to repeat itself? Do numeric types need a
"degree of force" (e.g., a Force5Float32 beats out a Force2Float64, so
the result is then typed as a Force5Float32 because 5 is "stronger"
than 2)? Where is this going?
Will adding forced types break number-crunching code that counts on
working with a greater precision internally? Are there any examples
of packages that use such a mechanism already in existence?
Forgive me for raising this point, I've mostly been a passive observer
of NumPy... This issue caught my attention.
Dave
--
David J. C. Beach
<beach@verinet.com>