MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / abs

Method abs

src/org/opensourcephysics/numerics/Complex.java:177–189  ·  view source on GitHub ↗

Returns the absolute value of the complex number.

()

Source from the content-addressed store, hash-verified

175 * Returns the absolute value of the complex number.
176 */
177 public double abs() {
178 double absRe = Math.abs(re);
179 double absIm = Math.abs(im);
180 if((absRe==0)&&(absIm==0)) {
181 return 0;
182 } else if(absRe>absIm) {
183 double temp = absIm/absRe;
184 return absRe*Math.sqrt(1+temp*temp);
185 } else {
186 double temp = absRe/absIm;
187 return absIm*Math.sqrt(1+temp*temp);
188 }
189 }
190
191 /**
192

Callers 15

solveMethod · 0.95
invertMethod · 0.95
determinantMethod · 0.95
schur2Method · 0.95
powerMethod · 0.95
logMethod · 0.95
asinMethod · 0.95
acosMethod · 0.95
atanMethod · 0.95
asinhMethod · 0.95
acoshMethod · 0.95
atanhMethod · 0.95

Calls 1

sqrtMethod · 0.80

Tested by 5

getCoordinateStringMethod · 0.64
getCoordinateStringMethod · 0.64
findNearestXIndexMethod · 0.64
findNearestXIndex0Method · 0.64
actionPerformedMethod · 0.64