From a34bf5bdf601d6d0ae5d28193090a29b9ef12600 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Mon, 22 Nov 2021 11:12:20 +0100
Subject: [PATCH] Switch the floating point type in rpmhook from float to
 double

There's no real reason why it should be float. Plus, the test if
the number is an integer does not work for big integers that
do not fit into a float.
---
 rpmio/rpmhook.c | 2 +-
 rpmio/rpmhook.h | 2 +-
 rpmio/rpmlua.c  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/rpmio/rpmhook.c b/rpmio/rpmhook.c
index 9fe2a21..1197983 100644
--- a/rpmio/rpmhook.c
+++ b/rpmio/rpmhook.c
@@ -187,7 +187,7 @@ static rpmhookArgs rpmhookArgsParse(const char *argt, va_list ap)
 		args->argv[i].i = va_arg(ap, int);
 		break;
 	    case 'f':
-		args->argv[i].f = (float)va_arg(ap, double);
+		args->argv[i].f = va_arg(ap, double);
 		break;
 	    case 'p':
 		args->argv[i].p = va_arg(ap, void *);
diff --git a/rpmio/rpmhook.h b/rpmio/rpmhook.h
index 52f5634..842c126 100644
--- a/rpmio/rpmhook.h
+++ b/rpmio/rpmhook.h
@@ -4,7 +4,7 @@
 typedef union {
     const char * s;
     int i;
-    float f;
+    double f;
     void * p;
 } rpmhookArgv;
 
diff --git a/rpmio/rpmlua.c b/rpmio/rpmlua.c
index fe2e513..c5bdf42 100644
--- a/rpmio/rpmlua.c
+++ b/rpmio/rpmlua.c
@@ -650,7 +650,7 @@ static int rpm_call(lua_State *L)
 		    args->argv[i].p = NULL;
 		    break;
 		case LUA_TNUMBER: {
-		    float f = (float)lua_tonumber(L, i+1);
+		    double f = (double)lua_tonumber(L, i+1);
 		    if (f == (int)f) {
 			argt[i] = 'i';
 			args->argv[i].i = (int)f;
-- 
1.8.3.1

