From a89063a5ff9bead0a140f315bfd10ac601a62e37 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 17 Jan 2018 07:44:26 +0000 Subject: [PATCH] PF_vlen: add casts to double to force 64-bit precision Fixes https://sourceforge.net/p/quakespasm/bugs/26/ (travail qte1m2.bsp button near 2772 767 -584 hurting the player sm179_otp.bsp: left button causing the player to get stuck) This change should probably be applied to more places in pr_cmds.c and elsewhere, but this specific change is enough to fix these corner cases git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1554 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/pr_cmds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Quake/pr_cmds.c b/Quake/pr_cmds.c index 115fe379..97d2b297 100644 --- a/Quake/pr_cmds.c +++ b/Quake/pr_cmds.c @@ -427,11 +427,11 @@ scalar vlen(vector) static void PF_vlen (void) { float *value1; - float new_temp; + double new_temp; value1 = G_VECTOR(OFS_PARM0); - new_temp = value1[0] * value1[0] + value1[1] * value1[1] + value1[2]*value1[2]; + new_temp = (double)value1[0] * value1[0] + (double)value1[1] * value1[1] + (double)value1[2]*value1[2]; new_temp = sqrt(new_temp); G_FLOAT(OFS_RETURN) = new_temp;