Small Problem

  • Thread starter Thread starter Yet Another One
  • Start date Start date
Y

Yet Another One

I am looking for some help on this.

I am trying to translate to do some math in VB, but I have no idea how
this works out in VB syntax.

Points=1426.79/(1+918.836*Power(2.71828, -0.00386405*rating))

How would I do this in VB? I've tried a number of different ways, but
I just can't seem to get it right.

TIA,

Ryan
 
Ryan,

Try this:
Dim Points As Decimal = 1426.79 / (1 + 918.836 *
Math.Pow(2.71828, -0.00386405 * rating))

Math.Pow comes from the Microsoft.VisualBasic namespace. Also, I assumed a
decimal type, you might want to narrow that to a double, or whatnot
depending on the required precision.

Hope this helps,


Steve
 
Ryan,

Try this:
Dim Points As Decimal = 1426.79 / (1 + 918.836 *
Math.Pow(2.71828, -0.00386405 * rating))

Math.Pow comes from the Microsoft.VisualBasic namespace. Also, I assumed a
decimal type, you might want to narrow that to a double, or whatnot
depending on the required precision.

Hope this helps,


Steve

Steve,

Thanks a TON! This helped a lot.

Much appreciated.

Ryan
 
It is worth noting that 2.71828 is just an approximation for e and therefore
the following is equivalent

Dim Points As Decimal = 1426.79 / (1 + 918.836 * Math.Exp(-0.00386405 *
rating))
 
It is worth noting that 2.71828 is just an approximation for e and therefore
the following is equivalent

Dim Points As Decimal = 1426.79 / (1 + 918.836 * Math.Exp(-0.00386405 *
rating))

Thanks for noting that, I hadn't noticed.

Ryan
 
Back
Top