Hi
I wanted to know if there is any way to find a square root of a number. I didn’t find any keyword regarding it.
Thanks in advance.
// Rohit Elamurugan
Hi
I wanted to know if there is any way to find a square root of a number. I didn’t find any keyword regarding it.
Thanks in advance.
// Rohit Elamurugan
Ummm I dont know but i learned it in 5th grade
I found a way to create a square root! Because math.sqrt
doesn’t work in grasshopper, I created a different function.
function sqrt(x) {
return x**0.5;
}
console.log(sqrt(numberGoesHere));
See if this works for you.
-Friidays
And by the way, the numberGoesHere
part can be filled with whatever number you’d like.
Oops, My bad! Math.sqrt
does work in grasshopper, it just needs to be capitalized. If you want to print out a square root, the simpler way is to do it this way:
console.log(Math.sqrt(numberGoesHere));
Of course, you could also use the function, but this is quicker and easier.
-Friidays