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
Angius10mo ago
Math.Pow()
MODiX
MODiX10mo 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
BiscuitsAndTea10mo ago
So would I write it like 1.3*(weight)/(height)Math.Pow(2.5)?
Angius
Angius10mo 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
BiscuitsAndTea10mo ago
Oh! I see, thank you!
jcotton42
jcotton4210mo ago
$close
MODiX
MODiX10mo ago
Use the /close command to mark a forum thread as answered
AntaoAlmada
AntaoAlmada10mo 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