>From 1da8e3d042207d7b8bba623c174440c18f27f95f Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Sun, 28 Dec 2025 18:00:15 +0000
Subject: [PATCH] Fix floating point handling in version comparison

(int)(1000 * strtod("0.821")) can result in 820 due to floating point
rounding errors.

Bug-Debian: https://bugs.debian.org/1121148

Bug: https://rt.cpan.org/Ticket/Display.html?id=170231
---
 lib/Object/Pad.xs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/Object/Pad.xs b/lib/Object/Pad.xs
index 7490122..8ea1620 100644
--- a/lib/Object/Pad.xs
+++ b/lib/Object/Pad.xs
@@ -8,6 +8,7 @@
 #include "EXTERN.h"
 #include "perl.h"
 #include "XSUB.h"
+#include <math.h>
 
 #include "XSParseKeyword.h"
 
@@ -437,7 +438,7 @@ static int build_classlike(pTHX_ OP **out, XSParseKeywordPiece *args[], size_t n
     SV **svp;
     if(hints &&
         (svp = hv_fetchs(hints, "Object::Pad/imported-version", 0)))
-      imported_version = SvNV(*svp) * 1000;
+      imported_version = round(SvNV(*svp) * 1000);
   }
 
   bool is_anon = false;
-- 
2.51.0

