Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | YangTegap |
GDScript has a function for square roots and cubed roots. But how, in GDScript would you figure out 4√x or 5√x ?
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | YangTegap |
GDScript has a function for square roots and cubed roots. But how, in GDScript would you figure out 4√x or 5√x ?
Reply From: | Gluon |
This should work although n and s would have to be floats not integers
func root(n, s):
print(pow(n, (1/s)))
I think you’ll get more expected results if you force float
division. Just this should work…
pow(n, 1.0/s)
jgodfrey | 2022-12-29 15:50
Yes good point! I should have thought of that!
Gluon | 2022-12-29 15:52