All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] float_trigo: Fix acos/asin/atan input generation
@ 2026-10-19 12:34 Jan Stancek via ltp
  2026-10-19 19:05 ` [LTP] " linuxtestproject.agent
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jan Stancek via ltp @ 2026-10-19 12:34 UTC (permalink / raw)
  To: ltp

genacos, genasin and genatan compute the step between input values as
2 / nbVal with both operands int, which evaluates to 0. Every one of the
20000 generated inputs is therefore exactly -1.0 and float_trigo only
ever checks acos(), asin() and atan() at a single point.

Use 2.0 / nbVal so the inputs are spread over [-1, 1) as intended.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/misc/math/float/trigo/genacos.c | 4 ++--
 testcases/misc/math/float/trigo/genasin.c | 4 ++--
 testcases/misc/math/float/trigo/genatan.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/testcases/misc/math/float/trigo/genacos.c b/testcases/misc/math/float/trigo/genacos.c
index 2ad051d26c1c..b15c44d8ff32 100644
--- a/testcases/misc/math/float/trigo/genacos.c
+++ b/testcases/misc/math/float/trigo/genacos.c
@@ -48,7 +48,7 @@ static int create_Result_file(void)
 	F_name = "racos";
 	nbVal = 20000;
 
-	Inc = 2 / nbVal;
+	Inc = 2.0 / nbVal;
 
 	for (i = 0; i < nbVal; i++)
 		tabRacos[i] = acos((Inc * i) - 1);
@@ -78,7 +78,7 @@ static int create_Data_file(void)
 	F_name = "dacos";
 	nbVal = 20000;
 
-	Inc = 2 / nbVal;
+	Inc = 2.0 / nbVal;
 
 	for (i = 0; i < nbVal; i++)
 		tabDacos[i] = -1 + (Inc * i);
diff --git a/testcases/misc/math/float/trigo/genasin.c b/testcases/misc/math/float/trigo/genasin.c
index 4614180e8cca..586bd22d72eb 100644
--- a/testcases/misc/math/float/trigo/genasin.c
+++ b/testcases/misc/math/float/trigo/genasin.c
@@ -48,7 +48,7 @@ static int create_Result_file(void)
 	F_name = "rasin";
 	nbVal = 20000;
 
-	Inc = 2 / nbVal;
+	Inc = 2.0 / nbVal;
 
 	for (i = 0; i < nbVal; i++)
 		tabRasin[i] = asin((Inc * i) - 1);
@@ -78,7 +78,7 @@ static int create_Data_file(void)
 	F_name = "dasin";
 	nbVal = 20000;
 
-	Inc = 2 / nbVal;
+	Inc = 2.0 / nbVal;
 
 	for (i = 0; i < nbVal; i++)
 		tabDasin[i] = (Inc * i) - 1;
diff --git a/testcases/misc/math/float/trigo/genatan.c b/testcases/misc/math/float/trigo/genatan.c
index 959b605bb884..94707c5ffd5a 100644
--- a/testcases/misc/math/float/trigo/genatan.c
+++ b/testcases/misc/math/float/trigo/genatan.c
@@ -48,7 +48,7 @@ static int create_Result_file(void)
 	F_name = "ratan";
 	nbVal = 20000;
 
-	Inc = 2 / nbVal;
+	Inc = 2.0 / nbVal;
 
 	for (i = 0; i < nbVal; i++)
 		tabRatan[i] = atan((Inc * i) - 1);
@@ -78,7 +78,7 @@ static int create_Data_file(void)
 	F_name = "datan";
 	nbVal = 20000;
 
-	Inc = 2 / nbVal;
+	Inc = 2.0 / nbVal;
 
 	for (i = 0; i < nbVal; i++)
 		tabDatan[i] = (Inc * i) - 1;
-- 
2.56.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-21 15:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-19 12:34 [LTP] [PATCH] float_trigo: Fix acos/asin/atan input generation Jan Stancek via ltp
2026-10-19 19:05 ` [LTP] " linuxtestproject.agent
2026-10-19 19:56 ` [LTP] [PATCH] " Avinesh Kumar via ltp
2026-10-21  9:33 ` Andrea Cervesato via ltp
2026-10-21 15:42   ` Jan Stancek via ltp

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.