<div dir="ltr"><div dir="ltr"><div>added tests for fegetround and fesetround in psxtests / psxfenv01 <br><br></div>fegetround fails to send the rounding direction due to soft float and returns to_nearest or zero in the cases</div><div>fesetround sends zero if the rounding direction is set and sends anything else if the function fails to set the rounding direction <br></div><div><br></div><div>can you check the patch for correctness <br><br></div><div>- Eshan <br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 25, 2020 at 8:26 PM Eshan dhawan <<a href="mailto:eshandhawan51@gmail.com">eshandhawan51@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">---<br>
testsuites/psxtests/psxfenv01/init.c | 42 +++++++++++++++++++++++++++-<br>
1 file changed, 41 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/testsuites/psxtests/psxfenv01/init.c b/testsuites/psxtests/psxfenv01/init.c<br>
index 05f3cdc880..4339139c58 100644<br>
--- a/testsuites/psxtests/psxfenv01/init.c<br>
+++ b/testsuites/psxtests/psxfenv01/init.c<br>
@@ -106,7 +106,47 @@ rtems_task Init(rtems_task_argument ignored)<br>
printf("fesetexceptflag ==> 0x%x\n", r);<br>
rtems_test_assert(r == 0);<br>
<br>
- <br>
+<br>
+ /*test for fegetround() and fesetround()*/<br>
+ /*they have four main macros to be tested seperated by ifdef*/<br>
+ /* since all the architectures dont support them */<br>
+ /*the test cases gets and sets the rounding directions */<br>
+#ifdef FE_TONEAREST<br>
+ <br>
+ r=fegetround();<br>
+ if(r)<br>
+ printf("fegetround ==> 0x%x\n", r);<br>
+ rtems_test_assert(r == FE_TONEAREST) ; <br>
+#endif<br>
+#ifdef FE_TOWARDZERO <br>
+<br>
+ r=fesetround(FE_TOWARDZERO);<br>
+ if(r)<br>
+ printf("fesetround ==> 0x%x\n", r); <br>
+ rtems_test_assert(r == 0) ;<br>
+ rtems_test_assert(fegetround() == FE_TOWARDZERO) ;<br>
+#endif<br>
+#ifdef FE_DOWNWARD<br>
+ <br>
+ r=fesetround(FE_DOWNWARD);<br>
+ if(r)<br>
+ printf("fesetround ==> 0x%x\n", r); <br>
+ rtems_test_assert(r == 0) ;<br>
+ rtems_test_assert(fegetround() == FE_DOWNWARD) ;<br>
+#endif<br>
+#ifdef FE_UPWARD<br>
+ r=fesetround(FE_UPWARD);<br>
+ if(r)<br>
+ printf("fesetround ==> 0x%x\n", r); <br>
+ rtems_test_assert(r == 0) ;<br>
+ rtems_test_assert(fegetround() == FE_UPWARD) ;<br>
+#endif<br>
+#ifdef FE_TONEAREST<br>
+ r=fesetround(FE_TONEAREST);<br>
+ if(r)<br>
+ printf("fesetround ==> 0x%x\n", r); <br>
+ rtems_test_assert(r == 0) ;<br>
+#endif<br>
<br>
<br>
#ifdef FE_DIVBYZERO<br>
-- <br>
2.17.1<br>
<br>
</blockquote></div></div>