OddQ¶
Status: Stable
documented, exercised by the test suite and/or worked examples, with no known limitations recorded.
Description¶
OddQ[n] gives True if n is an odd integer (Integer or BigInt), False otherwise.
Examples (2)¶
Every input below was run against the current Mathilda build and its output recorded.
Applications (2)¶
Implementation notes¶
builtin_oddq (src/core.c) returns True for an EXPR_INTEGER with n % 2 != 0, uses mpz_odd_p for an EXPR_BIGINT, and returns False for everything else.
Attributes: Protected.
References¶
See also: EvenQ
- Source:
src/core.c - Specification:
docs/spec/builtins/expression-information.md - Tests:
tests/test_bigint.c - Tests:
tests/test_compiledfunction.c - Tests:
tests/test_core.c - Tests:
tests/test_sum.c
Notes & additional examples¶
Notes¶
OddQ returns True only for odd integers (Integer or BigInt); any non-integer argument gives False.