[PATCH] test for fegetround and fesetround

Eshan Dhawan eshandhawan51 at gmail.com
Sun Mar 1 19:56:13 UTC 2020


hello everyone,
I am new here and I sent the patches:
1. > https://lists.rtems.org/pipermail/devel/2020-February/057669.html
2. > https://lists.rtems.org/pipermail/devel/2020-February/057671.html
3. > https://lists.rtems.org/pipermail/devel/2020-February/057711.html
a few days ago.
for adding tests to psxfenv01.
but no one reviewed it.
so I ping it back
if someone could review it and give feedback.

-- Eshan

On Tue, Feb 25, 2020 at 11:15 PM Eshan Dhawan <eshandhawan51 at gmail.com>
wrote:

> added tests for fegetround and fesetround in psxtests / psxfenv01
>
> fegetround fails to send the rounding direction due to soft float and
> returns to_nearest or zero  in the cases
> fesetround sends zero if the rounding direction is set and sends anything
> else if the function fails to set the rounding direction
>
> can you check the patch for correctness
>
> - Eshan
>
> On Tue, Feb 25, 2020 at 8:26 PM Eshan dhawan <eshandhawan51 at gmail.com>
> wrote:
>
>> ---
>>  testsuites/psxtests/psxfenv01/init.c | 42 +++++++++++++++++++++++++++-
>>  1 file changed, 41 insertions(+), 1 deletion(-)
>>
>> diff --git a/testsuites/psxtests/psxfenv01/init.c
>> b/testsuites/psxtests/psxfenv01/init.c
>> index 05f3cdc880..4339139c58 100644
>> --- a/testsuites/psxtests/psxfenv01/init.c
>> +++ b/testsuites/psxtests/psxfenv01/init.c
>> @@ -106,7 +106,47 @@ rtems_task Init(rtems_task_argument ignored)
>>        printf("fesetexceptflag ==> 0x%x\n", r);
>>      rtems_test_assert(r == 0);
>>
>> -
>> +
>> +    /*test for fegetround() and fesetround()*/
>> +    /*they have four main macros to be tested seperated by ifdef*/
>> +    /* since all the architectures dont support them */
>> +    /*the test cases gets and sets the rounding directions */
>> +#ifdef FE_TONEAREST
>> +
>> +    r=fegetround();
>> +    if(r)
>> +       printf("fegetround ==> 0x%x\n", r);
>> +    rtems_test_assert(r == FE_TONEAREST) ;
>> +#endif
>> +#ifdef FE_TOWARDZERO
>> +
>> +  r=fesetround(FE_TOWARDZERO);
>> +  if(r)
>> +       printf("fesetround ==> 0x%x\n", r);
>> +  rtems_test_assert(r == 0) ;
>> +  rtems_test_assert(fegetround() == FE_TOWARDZERO) ;
>> +#endif
>> +#ifdef FE_DOWNWARD
>> +
>> +  r=fesetround(FE_DOWNWARD);
>> +  if(r)
>> +       printf("fesetround ==> 0x%x\n", r);
>> +  rtems_test_assert(r == 0) ;
>> +  rtems_test_assert(fegetround() == FE_DOWNWARD) ;
>> +#endif
>> +#ifdef FE_UPWARD
>> +  r=fesetround(FE_UPWARD);
>> +  if(r)
>> +       printf("fesetround ==> 0x%x\n", r);
>> +  rtems_test_assert(r == 0) ;
>> +  rtems_test_assert(fegetround() == FE_UPWARD) ;
>> +#endif
>> +#ifdef FE_TONEAREST
>> +  r=fesetround(FE_TONEAREST);
>> +  if(r)
>> +       printf("fesetround ==> 0x%x\n", r);
>> +  rtems_test_assert(r == 0) ;
>> +#endif
>>
>>
>>  #ifdef FE_DIVBYZERO
>> --
>> 2.17.1
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200302/7844da61/attachment.html>


More information about the devel mailing list