Have a look at Post #63 where I quote Paul Bourke's response to the negative sin and cos segments.

He agrees that a solution that does not go down the pow() track is to create in the quadrant where ALL are positive, then mirror the other three quadrants.

That way you could use various values for n1 and n2 to make a family of supertoroids.

OME