Function sqrt [src]

Compute the square root of x2, returning error.NotSquare if x2 was not a square

Prototype

pub fn sqrt(x2: Fe) NotSquareError!Fe

Parameters

x2: Fe

Possible Errors

NotSquare NotSquareError

Source

pub fn sqrt(x2: Fe) NotSquareError!Fe { const x2_copy = x2; const x = x2.uncheckedSqrt(); const check = x.sq().sub(x2_copy); if (check.isZero()) { return x; } return error.NotSquare; }