Changeset e649dfa in mainline for softfloat/generic/softfloat.c


Ignore:
Timestamp:
2005-12-20T16:29:19Z (20 years ago)
Author:
Josef Cejka <malyzelenyhnus@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ef0aa999
Parents:
7e557805
Message:

Comparison function for float type added.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • softfloat/generic/softfloat.c

    r7e557805 re649dfa  
    137137        return __eqsf2(a,b);
    138138};
     139
     140/* return value >= 0 if a>=b and neither is NaN */
     141int __gesf2(float a, float b)
     142{
     143        float32 fa,fb;
     144        fa.f=a;
     145        fb.f=b;
     146        if ((isFloat32NaN(fa))||(isFloat32NaN(fb))) {
     147                /* TODO: sigNaNs*/
     148                return 1;
     149                };
     150       
     151        if (isFloat32eq(fa,fb)) {
     152                return 0;
     153        };
     154       
     155        if (isFloat32gt(fa,fb)) {
     156                return 1;
     157                };
     158       
     159        return -1;
     160}
     161
     162/** Return negative value, if a<b and neither is NaN*/
     163int __ltsf2(float a, float b)
     164{
     165        float32 fa,fb;
     166        fa.f=a;
     167        fb.f=b;
     168        if ((isFloat32NaN(fa))||(isFloat32NaN(fb))) {
     169                /* TODO: sigNaNs*/
     170                return 1;
     171                };
     172        if (isFloat32lt(fa, fb)) {
     173                return -1;
     174                };
     175        return 0;
     176}
     177
     178/* return value <= 0 if a<=b and neither is NaN */
     179int __lesf2(float a, float b)
     180{
     181        float32 fa,fb;
     182        fa.f=a;
     183        fb.f=b;
     184        if ((isFloat32NaN(fa))||(isFloat32NaN(fb))) {
     185                /* TODO: sigNaNs*/
     186                return 1;
     187                };
     188       
     189        if (isFloat32eq(fa,fb)) {
     190                return 0;
     191        };
     192       
     193        if (isFloat32lt(fa,fb)) {
     194                return -1;
     195                };
     196       
     197        return 1;
     198}
     199
     200/** Return positive value, if a>b and neither is NaN*/
     201int __ltsf2(float a, float b)
     202{
     203        float32 fa,fb;
     204        fa.f=a;
     205        fb.f=b;
     206        if ((isFloat32NaN(fa))||(isFloat32NaN(fb))) {
     207                /* TODO: sigNaNs*/
     208                return 1;
     209                };
     210        if (isFloat32gt(fa, fb)) {
     211                return 1;
     212                };
     213        return 0;
     214}
     215
    139216/* Other functions */
    140217
Note: See TracChangeset for help on using the changeset viewer.