From 99acaceca53e092a501573a27737ddadc8da7b22 Mon Sep 17 00:00:00 2001 From: Harsh Mathur <104578544+Harsh-Mathur-1503@users.noreply.github.com> Date: Tue, 12 Nov 2024 20:01:52 +0530 Subject: [PATCH] Update main.c Signed-off-by: Harsh Mathur <104578544+Harsh-Mathur-1503@users.noreply.github.com> --- .../@stdlib/math/base/special/lcmf/src/main.c | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/lcmf/src/main.c b/lib/node_modules/@stdlib/math/base/special/lcmf/src/main.c index b87d490be81..85e05f3b868 100644 --- a/lib/node_modules/@stdlib/math/base/special/lcmf/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/lcmf/src/main.c @@ -32,31 +32,26 @@ * // returns 42.0f */ float stdlib_base_lcmf( const float a, const float b ) { - float abs_a; - float abs_b; - float gcd_value; + double abs_a; + double abs_b; + double gcd_value; const double b = 1.0; - if(a==0.0||b==0.0){ + if ( a == 0.0 || b == 0.0 ) { return 0.0; } - if(a<0.0){ - abs_a=-a; - }else{ - abs_a=a; + if ( a < 0.0 ) { + abs_a = -a; + } else { + abs_a = a; } - if(b<0.0){ - abs_b=-b; - }else{ - abs_b=b; + if ( b < 0.0 ) { + abs_b = -b; + } else { + abs_b = b; } - - abs_a=(a<0.0f)?-a:a; - abs_b=(b<0.0f)?-b:b; - // Note: we rely on `gcd` to perform further argument validation... gcd_value=stdlib_base_gcd(abs_a,abs_b); - if(stdlib_base_is_nan(gcd_value)){ return gcd_value; }