Re: Formatting a string for proper calculation

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Anders Altberg (x_pragma_at_telia.com)
Date: 09/05/04


Date: Sun, 5 Sep 2004 13:09:44 +0200

Hi Edhy
replace the actual number with the maximum number of variable with an
fefault value of 0 for things to add and 1 for thingfs to multiply or add
a=0
b=0
c=0
d=1
e=1
lnRetVal= (a+b+c)*d/e
Now call the function with your values
? x(a,b,c,d,e)
with a=12,c=3,d=3 the returned value ln RetVal =5
Function x (a,b,c,d,e)
RETURN (a+b+c)*d/e

"Edhy Rijo" <erijo@msn.com.NO_SPAM> wrote in message
news:eqNjk3ukEHA.3432@TK2MSFTNGP14.phx.gbl...
> Hi Gene,
>
> I am sorry for not properly explain the whole situation. Fred already
gave
> me a startup push to properly do what I need to do.
>
> > Why are you using evaluate() later? Why not simply calculate the value
at
> > that point of discussion? You may have a legitimate reason
> > for proceeding as you are, but I sure can not see it.
>
> These are formulas to calculate item prices, specifically for a Windows
> Manufacturer, the formulas will be created for several items and they may
> have at least 3 operands and for now a maximum of 5 operands, at the time
of
> processing the transaction, the formula will be used and using STRTRAN()
the
> values are replace and the end result is EVALUATED, with a couple of
samples
> I did, I found that the end result did no came in properly without pairing
> the operands with <( )>, which is why I started this thread.
>
> --
> Edhy Rijo
> Programming System Solutions www.progytech.com
> Bronx NY
>
>
> "Gene Wirchenko" <genew@mail.ocis.net> wrote in message
> news:jhskj0lciv09mkfdvibbm7ogh9joffv1kf@4ax.com...
> > "Edhy Rijo" <erijo@msn.com.NO_SPAM> wrote:
> >
> >>Hi Fred,
> >>
> >>I don't want the user to be involve in adding the parenthesis, I though
> >>that
> >>I could identify each pair of values to be calculated and then add a
> >>parenthesis to this and so on, which could result in this:
> >>
> >>x = [30.00 + 36.00 * 0.1800] && Original Formula
> >>x = [(30.00 + 36.00) * (0.1800)] && Formatted Formula, by pairs of
> >>values
> >>
> >>Any idea how to code this?
> >
> > Code what?
> >
> > Your problem is so ill-defined, at least to us, at this point
> > that it is doubtful anyone can help you. I suspect you may not have
> > it yet either.
> >
> > Why are you using evaluate() later? Why not simply calculate the
> > value at that point of discussion? You may have a legitimate reason
> > for proceeding as you are, but I sure can not see it.
> >
> > Sincerely,
> >
> > Gene Wirchenko
> >
> > Computerese Irregular Verb Conjugation:
> > I have preferences.
> > You have biases.
> > He/She has prejudices.
>
>