IntJacobiWithError
Description
Compute the Jacobi symbol (a/n) with explicit failure channel.
Parameters
| Name | Direction | Description |
|---|---|---|
a |
in | Numerator. |
n |
in | Odd positive modulus. |
error |
out | Optional pointer set to true on failure (invalid n) and false on success. |
Success
Returns -1, 0, or 1 reflecting the Jacobi symbol. Neither operand is modified. When error is non-NULL, *error is set to false.
Failure
Returns 0 when n is even, zero, or otherwise invalid for the Jacobi computation. When error is non-NULL, *error is set to true so the caller can distinguish failure from a true 0 result.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Int.c:1900:
}
int IntJacobiWithError(Int *a, Int *n, bool *error) {
int out = 0;
bool ok = IntTryJacobi(&out, a, n);- In
Math.h:776:
static inline int int_jacobi_no_error(Int *a, Int *n) {
return IntJacobiWithError(a, n, NULL);
}- In
Math.h:801:
/// TAGS: Int, Math, Jacobi, NumberTheory, Macro
///
#define IntJacobi(...) INT_JACOBI_SELECT(__VA_ARGS__, IntJacobiWithError, int_jacobi_no_error)(__VA_ARGS__)
#ifdef __cplusplus
Last updated on