```{index} single: gmp_tstbit; Math::GMP function ``` ```{index} single: Math::GMP::gmp_tstbit; Perl function ``` # gmp_tstbit Return bit `$n` of `$x` (0-indexed, from the least significant end). ## Synopsis ```perl my $x = Math::GMP->new(0b1010); print $x->gmp_tstbit(1); # 1 print $x->gmp_tstbit(2); # 0 ``` For negative values, `libgmp` uses a two's-complement view. Bits above the most significant set bit of a positive value read as `0`.