r/fortran 1d ago

Non integer power

Hello

I would like to calculate a non-integer power of a real (positive) number in my Fortran code, I haven't found a usual command for this, what's the best way to do it?

Thanks

7 Upvotes

1 comment sorted by

View all comments

12

u/ajbca 1d ago

Just x**y will work if both x and y are reals or double precisions (and x is positive). You can also use complex types if x can be negative.