c# - Return value of math.sqrt -
i have been try draw function of y^2=4*a*x have run problem. when use math.sqrt function find square root of value has 2 answer +or- positive value. i.e if found sqrt of 4 return +2 instead of + or -2.
any appreciated.
you can write own method return both values:
public static ienumerable<double> sqrt(double d) { var result = math.sqrt(d); yield return result; yield return -result; }
Comments
Post a Comment