float_trigo: Fix acos/asin/atan input generation
PATCH 1/1 float_trigo: Fix acos/asin/atan input generation
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.
--- 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(-)
testcases/misc/math/float/trigo/genacos.c +2 -2
@@ -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);
testcases/misc/math/float/trigo/genasin.c +2 -2
@@ -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 ;
testcases/misc/math/float/trigo/genatan.c +2 -2
@@ -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 ;
Signature · 5 lines
2.56.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Jan,
Quoted 1 line · Jan Stancek via ltp
float_trigo: Fix acos/asin/atan input generation
Verdict - Reviewed
Pre-existing issue (low severity; separate follow-up):
In genacos.c, genasin.c and genatan.c, both create_*_file() functions test open() with if (!fp) and ignore write() failures. An output path that is a directory therefore makes either mode report success and exit 0 without producing data, both before and after this patch. Check fp < 0, handle write() failures and propagate failure from main().
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi,
Regards,
Avinesh
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Pushed.
Quoted 8 lines · Andrea Cervesato
Reviewed-by Andrea Cervesato <[email protected]>--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp