@@ -8742,6 +8742,14 @@ S_sv_numcmp_common(pTHX_ SV **sv1, SV **sv2, const U32 flags,
87428742=for apidoc_item sv_numeq_flags
87438743=for apidoc_item sv_numne
87448744=for apidoc_item sv_numne_flags
8745+ =for apidoc_item sv_numge
8746+ =for apidoc_item sv_numge_flags
8747+ =for apidoc_item sv_numgt
8748+ =for apidoc_item sv_numgt_flags
8749+ =for apidoc_item sv_numle
8750+ =for apidoc_item sv_numle_flags
8751+ =for apidoc_item sv_numlt
8752+ =for apidoc_item sv_numlt_flags
87458753
87468754These return a boolean that is the result of the corresponding numeric
87478755comparison:
@@ -8760,17 +8768,42 @@ Numeric equality, the same as S<C<$sv1 == $sv2>>.
87608768
87618769Numeric inequality, the same as S<C<$sv1 != $sv2>>.
87628770
8771+ =item C<sv_numle>
8772+
8773+ =item C<sv_numle_flags>
8774+
8775+ Numeric less than or equal, the same as S<C<$sv1 E<lt>= $sv2>>.
8776+
8777+ =item C<sv_numlt>
8778+
8779+ =item C<sv_numlt_flags>
8780+
8781+ Numeric less than, the same as S<C<$sv1 E<lt> $sv2>>.
8782+
8783+ =item C<sv_numge>
8784+
8785+ =item C<sv_numge_flags>
8786+
8787+ Numeric greater than or equal, the same as S<C<$sv1 E<gt>= $sv2>>.
8788+
8789+ =item C<sv_numgt>
8790+
8791+ =item C<sv_numgt_flags>
8792+
8793+ Numeric greater than, the same as S<C<$sv1 E<gt> $sv2>>.
8794+
87638795=back
87648796
8765- Beware that in the presence of overloading C<==> may not be a strict
8766- inverse of C<!=>.
8797+ Beware that in the presence of overloading the comparisons might not
8798+ have their normal properties, eg. C< sv_numeq(sv1, sv2) > might be
8799+ different to C< !sv_numne(sv1, sv2) >.
87678800
87688801The non-C<_flags> suffix versions of these functions always perform
87698802get magic and handle the appropriate type of overloading. See
87708803L<overload> for details.
87718804
87728805These each return a boolean indicating if the numbers in the two SV
8773- arguments are equal or not equal , coercing them to numbers if
8806+ arguments satisfy the given relationship , coercing them to numbers if
87748807necessary, basically behaving like the Perl code.
87758808
87768809A NULL SV is treated as C<undef>.
@@ -8813,14 +8846,65 @@ Perl_sv_numne_flags(pTHX_ SV *sv1, SV *sv2, const U32 flags)
88138846{
88148847 PERL_ARGS_ASSERT_SV_NUMNE_FLAGS;
88158848
8816-
88178849 SV *result;
88188850 if (UNLIKELY(sv_numcmp_common(&sv1, &sv2, flags, ne_amg, &result)))
88198851 return SvTRUE(result);
88208852
88218853 return do_ncmp(sv1, sv2) != 0;
88228854}
88238855
8856+ bool
8857+ Perl_sv_numle_flags(pTHX_ SV *sv1, SV *sv2, const U32 flags)
8858+ {
8859+ PERL_ARGS_ASSERT_SV_NUMLE_FLAGS;
8860+
8861+ SV *result;
8862+ if (UNLIKELY(sv_numcmp_common(&sv1, &sv2, flags, le_amg, &result)))
8863+ return SvTRUE(result);
8864+
8865+ return do_ncmp(sv1, sv2) <= 0;
8866+ }
8867+
8868+ bool
8869+ Perl_sv_numlt_flags(pTHX_ SV *sv1, SV *sv2, const U32 flags)
8870+ {
8871+ PERL_ARGS_ASSERT_SV_NUMLT_FLAGS;
8872+
8873+ SV *result;
8874+ if (UNLIKELY(sv_numcmp_common(&sv1, &sv2, flags, lt_amg, &result)))
8875+ return SvTRUE(result);
8876+
8877+ return do_ncmp(sv1, sv2) < 0;
8878+ }
8879+
8880+ bool
8881+ Perl_sv_numge_flags(pTHX_ SV *sv1, SV *sv2, const U32 flags)
8882+ {
8883+ PERL_ARGS_ASSERT_SV_NUMGE_FLAGS;
8884+
8885+ SV *result;
8886+ if (UNLIKELY(sv_numcmp_common(&sv1, &sv2, flags, ge_amg, &result)))
8887+ return SvTRUE(result);
8888+
8889+ I32 cmp = do_ncmp(sv1, sv2);
8890+
8891+ return cmp != 2 && cmp >= 0;
8892+ }
8893+
8894+ bool
8895+ Perl_sv_numgt_flags(pTHX_ SV *sv1, SV *sv2, const U32 flags)
8896+ {
8897+ PERL_ARGS_ASSERT_SV_NUMGT_FLAGS;
8898+
8899+ SV *result;
8900+ if (UNLIKELY(sv_numcmp_common(&sv1, &sv2, flags, gt_amg, &result)))
8901+ return SvTRUE(result);
8902+
8903+ I32 cmp = do_ncmp(sv1, sv2);
8904+
8905+ return cmp != 2 && cmp > 0;
8906+ }
8907+
88248908/*
88258909=for apidoc sv_numcmp
88268910=for apidoc_item sv_numcmp_flags
0 commit comments