Subject Re: Computer By ?
Author sesummers
--- In Firebird-general@yahoogroups.com, "buitrgon@h..."
<buitragon@h...> wrote:
> Hi:
>
> Í´v two fields:
> Price and Merma,
> Price is Float and Merma is an SmallInt.
>
> I need to write a new field like this:
>
> New_Field = (Merma/100) * Price) + Price.
>
> I´d write a Computer By Field like below:
>
> ((MERMA/100) + PRICE) + PRICE.
>
> It round the value to the same value of Price because (MERMA/100)
not accept
> decimals.
>
> What can I Do?

Assuming your first example was right (the 2nd one has a "+" where
the first has a "*"), try
((MERMA * PRICE)/100.0) + PRICE.

Mathmatically it's the same thing, but multiplying by Price will
promote the result to "Float".