VB6 to Basic4 android

ciginfo

Well-Known Member
Licensed User
Longtime User
Bonjour,
How to convert "P1 = (0.0005831 + Math.Exp(-16.1992104 + (0.2892432 * Age)))" from VB to B4A

If i code
Dim P1, age as double
age = 20
P1 = (0.0005831 + power(-16.1992104 + (0.2892432 * age)))
ERROR

Error compiling program.
Error description: Missing parameter.
Occurred on line: 95
P1 = (0.0005831 + power(-16.1992104 + (0.2892432 * age)))
Word: )

Thank you
 

ciginfo

Well-Known Member
Licensed User
Longtime User
OK,thank you
B4A is very different of VB
I can 't convert also this code:

RR = 10 ^ ((0.2718 * Math.Log(Terme) * Math.Log(Terme) * 0.434294482 * 0.434294482) - (1.023 * Math.Log(Terme) * 0.434294482) + 0.9425)

Thank you if you can help me, and is there any tuto to calculate with B4A ?

François
 
Upvote 0

ciginfo

Well-Known Member
Licensed User
Longtime User
I've seen but not found how to convert : Log, Round, ^

With VB
A = Log(B) / 2

A = (B ^ 2)

A = Round(B)

And with B4A ????
 
Upvote 0

ciginfo

Well-Known Member
Licensed User
Longtime User
I have tried like this

Dim Zd, Zu, MoM As Double
MoM = 1
Zd = ((0.434294481903252 * (Logarithm(MoM))) - 0.305) / 0.235

ERROR

Compiling code. Error
Error compiling program.
Error description: Missing parameter.
Occurred on line: 119
Zd = ((0.434294481903252 * (Logarithm(MoM))) - 0.305) / 0.235
Word: )

I don't undersatand
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
Logarithm requires two parameters

Number (as double), and base (as double)
presuming base 10, your line would be
B4X:
Zd = ((0.434294481903252 * (Logarithm(MoM, 10))) - 0.305) / 0.235
 
Upvote 0

ciginfo

Well-Known Member
Licensed User
Longtime User
Logarithm requires two parameters

Number (as double), and base (as double)
If I use base = 10 it returns result very different vith VisualBasic

With VB
MoM = 15
Zd = ((0.434294481903252 * (Log(MoM))) - 0.305) / 0.235
Zd = 3.706

With Java
MoM = 15
Zd = ((0.434294481903252 * (Math.Log(MoM))) - 0.305) / 0.235
Zd = 3.706

Vith B4A
MoM = 15
Zd = ((0.434294481903252 * (Logarithm(MoM, 10))) - 0.305) / 0.235
Zd = 0.875

How choose the base, vith Vb and with Java there is not Base???
What is base?

Thank you
 
Upvote 0
Top