# Re: [HACKERS] Proposal for resolving casting issues

```
> "Zeugswetter Andreas SB SD" <[EMAIL PROTECTED]> writes:
> > Note that if you write, say,
> > set numericcol = numericcol * 3.14159;
> > my proposal would do the "right thing" since the constant would be typed
> > as numeric to start with and would stay that way.  To do what you want
> > with a float variable, it'd be necessary to write
> > set numericcol = numericcol * float4col::numeric;
>
> > Yes, that is the case where the new behavior would imho not be good (but you
> > say spec compliant). I loose precision even though there is room to hold it.
>
> Lose what precision?  It seems silly to imagine that the product of```
```
Have you seen my example ? If calculated in float4 the result of
1.00000000000001*1000.0-1000.0 would be 0.0, no ?

> a numeric and a float4 is good to more digits than there are in the
> float4.  This is exactly the spec's point: combining an exact and an
> approximate input will give you an approximate result.

Does it actually say how approximate the result needs to be, or is it simply
approximate by nature that one part was only approximate ?
Do they really mean, that an approximate calculation with one float4 must be
calculated in float4 arithmetic ? If you e.g. calculate in float8 it would still
be an approximate result and thus imho conform.

> (Unless of course the value in the float4 happens to be exact, eg,
> an integer of not very many digits.  But if you are relying on that
> to be true, why aren't you using an exact format for storing it?)

Probably because the approximate is more efficient in storage size,
or the designer knew he only wants to store 6 significant digits ?

> > Informix does the calculations in numeric, and then converts the result
> > if no casts are supplied (would do set float4col = float4(float4col::numeric *
>numericcol)).
>
> I am not sure what the argument is for following Informix's lead rather
> than the standard's lead; especially when Informix evidently doesn't
> understand numerical analysis ;-)

It was only an example of how someone else does it and was why I asked what
other db's do. I would e.g. suspect Oracle does it similarily.
Please, someone check another db !

Andreas