Writing something to the power of?

I'm unsure if I phrased this correctly, but I have to write something to the power of 2.5 and I'm unsure of how to write it in visual studio. Sorry if this is a bit of a basic question, but I'm grateful for any help! The whole math equation is part of a BMI calculator so i have to write "1.3*weight(kg)/height(m)^2.5".
8 Replies
Angius
Angius11mo ago
Math.Pow()
MODiX
MODiX11mo ago
Angius
REPL Result: Success
Math.Pow(2, 3)
Math.Pow(2, 3)
Result: double
8
8
Compile: 260.918ms | Execution: 17.215ms | React with ❌ to remove this embed.
BiscuitsAndTea
BiscuitsAndTeaOP11mo ago
So would I write it like 1.3*(weight)/(height)Math.Pow(2.5)?
Angius
Angius11mo ago
No "X to the power of Y" will be Math.Pow(X, Y) Note the comma separating the two parameters Math.Pow(base, exponent)
BiscuitsAndTea
BiscuitsAndTeaOP11mo ago
Oh! I see, thank you!
jcotton42
jcotton4211mo ago
$close
MODiX
MODiX11mo ago
Use the /close command to mark a forum thread as answered
AntaoAlmada
AntaoAlmada11mo ago
For example, for 2^2.5, with .NET 7 or later, you have the flexibility to employ either float.Pow(2, 2.5f) or double.Pow(2, 2.5), depending on the precision required. In case you're working with earlier versions, utilize MathF.Pow(2, 2.5f) or Math.Pow(2, 2.5) accordingly.
Want results from more Discord servers?
Add your server