The last commit didn't correctly catch 1 v.s. 1.5, use Perl's fmod function to check... more_than_32_bit_Int_on_32_bit_systems
Ævar Arnfjörð Bjarmason [Sat, 27 Feb 2010 21:08:30 +0000 (21:08 +0000)]
xs-src/MouseTypeConstraints.xs

index a7ff390..7068a5b 100644 (file)
@@ -120,9 +120,14 @@ mouse_tc_Num(pTHX_ SV* const data PERL_UNUSED_DECL, SV* const sv) {
 int
 mouse_tc_Int(pTHX_ SV* const data PERL_UNUSED_DECL, SV* const sv) {
     assert(sv);
-    if(SvIOKp(sv) || SvNOKp(sv)){
+    if(SvIOKp(sv)){
         return TRUE;
     }
+    else if(SvNOKp(sv)) {
+        NV const nv = SvNVX(sv);
+        NV mod = Perl_fmod( nv, 1 );
+        return mod == 0;
+    }
     else if(SvPOKp(sv)){
         int const num_type = grok_number(SvPVX(sv), SvCUR(sv), NULL);
         if(num_type){