MCPcopy Index your code
hub / github.com/processing/processing / lsqrt

Method lsqrt

core/src/processing/opengl/LinePath.java:570–590  ·  view source on GitHub ↗
(long x)

Source from the content-addressed store, hash-verified

568
569
570 public static long lsqrt(long x) {
571 int fracbits = 16;
572
573 long root = 0;
574 long remHi = 0;
575 long remLo = x;
576 int count = 31 + fracbits / 2;
577
578 do {
579 remHi = (remHi << 2) | (remLo >>> 62); // N.B. - unsigned shift R
580 remLo <<= 2;
581 root <<= 1;
582 long testDiv = (root << 1) + 1;
583 if (remHi >= testDiv) {
584 remHi -= testDiv;
585 root++;
586 }
587 } while (count-- != 0);
588
589 return root;
590 }
591
592
593 public static double hypot(double x, double y) {

Callers 1

hypotMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected