@@ -8748,6 +8748,14 @@ S_sv_numcmp_common(pTHX_ SV **sv1, SV **sv2, const U32 flags,
87488748=for apidoc_item sv_numeq_flags
87498749=for apidoc_item sv_numne
87508750=for apidoc_item sv_numne_flags
8751+ =for apidoc_item sv_numge
8752+ =for apidoc_item sv_numge_flags
8753+ =for apidoc_item sv_numgt
8754+ =for apidoc_item sv_numgt_flags
8755+ =for apidoc_item sv_numle
8756+ =for apidoc_item sv_numle_flags
8757+ =for apidoc_item sv_numlt
8758+ =for apidoc_item sv_numlt_flags
87518759
87528760These return a boolean that is the result of the corresponding numeric
87538761comparison:
@@ -8766,17 +8774,42 @@ Numeric equality, the same as S<C<$sv1 == $sv2>>.
87668774
87678775Numeric inequality, the same as S<C<$sv1 != $sv2>>.
87688776
8777+ =item C<sv_numle>
8778+
8779+ =item C<sv_numle_flags>
8780+
8781+ Numeric less than or equal, the same as S<C<$sv1 E<lt>= $sv2>>.
8782+
8783+ =item C<sv_numlt>
8784+
8785+ =item C<sv_numlt_flags>
8786+
8787+ Numeric less than, the same as S<C<$sv1 E<lt> $sv2>>.
8788+
8789+ =item C<sv_numge>
8790+
8791+ =item C<sv_numge_flags>
8792+
8793+ Numeric greater than or equal, the same as S<C<$sv1 E<gt>= $sv2>>.
8794+
8795+ =item C<sv_numgt>
8796+
8797+ =item C<sv_numgt_flags>
8798+
8799+ Numeric greater than, the same as S<C<$sv1 E<gt> $sv2>>.
8800+
87698801=back
87708802
8771- Beware that in the presence of overloading C<==> may not be a strict
8772- inverse of C<!=>.
8803+ Beware that in the presence of overloading the comparisons might not
8804+ have their normal properties, eg. C< sv_numeq(sv1, sv2) > might be
8805+ different to C< !sv_numne(sv1, sv2) >.
87738806
87748807The non-C<_flags> suffix versions of these functions always perform
87758808get magic and handle the appropriate type of overloading. See
87768809L<overload> for details.
87778810
87788811These each return a boolean indicating if the numbers in the two SV
8779- arguments are equal or not equal , coercing them to numbers if
8812+ arguments satisfy the given relationship , coercing them to numbers if
87808813necessary, basically behaving like the Perl code.
87818814
87828815A NULL SV is treated as C<undef>.
@@ -8819,14 +8852,65 @@ Perl_sv_numne_flags(pTHX_ SV *sv1, SV *sv2, const U32 flags)
88198852{
88208853 PERL_ARGS_ASSERT_SV_NUMNE_FLAGS;
88218854
8822-
88238855 SV *result;
88248856 if (UNLIKELY(sv_numcmp_common(&sv1, &sv2, flags, ne_amg, &result)))
88258857 return SvTRUE(result);
88268858
88278859 return do_ncmp(sv1, sv2) != 0;
88288860}
88298861
8862+ bool
8863+ Perl_sv_numle_flags(pTHX_ SV *sv1, SV *sv2, const U32 flags)
8864+ {
8865+ PERL_ARGS_ASSERT_SV_NUMLE_FLAGS;
8866+
8867+ SV *result;
8868+ if (UNLIKELY(sv_numcmp_common(&sv1, &sv2, flags, le_amg, &result)))
8869+ return SvTRUE(result);
8870+
8871+ return do_ncmp(sv1, sv2) <= 0;
8872+ }
8873+
8874+ bool
8875+ Perl_sv_numlt_flags(pTHX_ SV *sv1, SV *sv2, const U32 flags)
8876+ {
8877+ PERL_ARGS_ASSERT_SV_NUMLT_FLAGS;
8878+
8879+ SV *result;
8880+ if (UNLIKELY(sv_numcmp_common(&sv1, &sv2, flags, lt_amg, &result)))
8881+ return SvTRUE(result);
8882+
8883+ return do_ncmp(sv1, sv2) < 0;
8884+ }
8885+
8886+ bool
8887+ Perl_sv_numge_flags(pTHX_ SV *sv1, SV *sv2, const U32 flags)
8888+ {
8889+ PERL_ARGS_ASSERT_SV_NUMGE_FLAGS;
8890+
8891+ SV *result;
8892+ if (UNLIKELY(sv_numcmp_common(&sv1, &sv2, flags, ge_amg, &result)))
8893+ return SvTRUE(result);
8894+
8895+ I32 cmp = do_ncmp(sv1, sv2);
8896+
8897+ return cmp != 2 && cmp >= 0;
8898+ }
8899+
8900+ bool
8901+ Perl_sv_numgt_flags(pTHX_ SV *sv1, SV *sv2, const U32 flags)
8902+ {
8903+ PERL_ARGS_ASSERT_SV_NUMGT_FLAGS;
8904+
8905+ SV *result;
8906+ if (UNLIKELY(sv_numcmp_common(&sv1, &sv2, flags, gt_amg, &result)))
8907+ return SvTRUE(result);
8908+
8909+ I32 cmp = do_ncmp(sv1, sv2);
8910+
8911+ return cmp != 2 && cmp > 0;
8912+ }
8913+
88308914/*
88318915=for apidoc sv_numcmp
88328916=for apidoc_item sv_numcmp_flags
0 commit comments