|
| 1 | +#include "stdint.h" |
| 2 | + |
| 3 | +#include "qfplib-m0-full.h" |
| 4 | + |
| 5 | +//__aeabi_frsub 2 float float 返回 y 减去 x |
| 6 | +float __aeabi_frsub(float x, float y) |
| 7 | +{ |
| 8 | + return __aeabi_fsub(y,x); |
| 9 | +} |
| 10 | +//_frdiv 2 float float 返回 y 除以 x |
| 11 | +float _frdiv(float x, float y) |
| 12 | +{ |
| 13 | + return __aeabi_fdiv(y,x); |
| 14 | +} |
| 15 | +//__aeabi_drsub 2 double double 返回 y 减去 x |
| 16 | +double __aeabi_drsub(double x, double y) |
| 17 | +{ |
| 18 | + return __aeabi_dsub(y,x); |
| 19 | +} |
| 20 | +//_drdiv 2 double double 返回 y 除以 x |
| 21 | +double _drdiv(double x, double y) |
| 22 | +{ |
| 23 | + return __aeabi_ddiv(y,x); |
| 24 | +} |
| 25 | + |
| 26 | +/* |
| 27 | +_frem 2 float float 返回 x 除以 y 的余数(参见注释 a) |
| 28 | +_frnd float float 返回 x 四舍五入为整数(参见注释 b) |
| 29 | +_drem 2 double double 返回 x 除以 y 的余数(参见注释 a 和 c) |
| 30 | +_drnd double double 返回 x 四舍五入为整数(参见注释 b) |
| 31 | +
|
| 32 | +_ffix_r float int |
| 33 | +_ffixu_r float unsigned int |
| 34 | +_dfix_r double int |
| 35 | +_dfixu_r double unsigned int |
| 36 | +_ll_sfrom_f_r float long long |
| 37 | +_ll_ufrom_f_r float unsigned long long |
| 38 | +_ll_sfrom_d_r double long long |
| 39 | +_ll_ufrom_d_r double unsigned long long |
| 40 | +
|
| 41 | +https://developer.arm.com/documentation/dui0475/m/floating-point-support/the-software-floating-point-library--fplib/fplib-comparisons-between-floats-and-doubles?lang=en |
| 42 | +https://developer.arm.com/documentation/dui0475/m/floating-point-support/the-software-floating-point-library--fplib/fplib-c99-functions?lang=en |
| 43 | +*/ |
| 44 | + |
| 45 | +//These functions return zero if neither argument is NaN, and a and b are equal. |
| 46 | +int __eqsf2(float a, float b) { return qfp_fcmp(a,b);} |
| 47 | +int __eqdf2(double a, double b) { return qfp_dcmp(a,b);} |
| 48 | +//These functions return a nonzero value if either argument is NaN, or if a and b are unequal. |
| 49 | +int __nesf2(float a, float b) { return qfp_fcmp(a,b);} |
| 50 | +int __nedf2(double a, double b) { return qfp_dcmp(a,b);} |
| 51 | +//These functions return a value greater than or equal to zero if neither argument is NaN, and a is greater than or equal to b. |
| 52 | +int __gesf2(float a, float b) { return qfp_fcmp(a,b);} |
| 53 | +int __gedf2(double a, double b) { return qfp_dcmp(a,b);} |
| 54 | +//These functions return a value less than zero if neither argument is NaN, and a is strictly less than b. |
| 55 | +int __ltsf2(float a, float b) { return qfp_fcmp(a,b);} |
| 56 | +int __ltdf2(double a, double b) { return qfp_dcmp(a,b);} |
| 57 | +//These functions return a value less than or equal to zero if neither argument is NaN, and a is less than or equal to b. |
| 58 | +int __lesf2(float a, float b) { return qfp_fcmp(a,b);} |
| 59 | +int __ledf2(double a, double b) { return qfp_dcmp(a,b);} |
| 60 | +//These functions return a value greater than zero if neither argument is NaN, and a is strictly greater than b. |
| 61 | +int __gtsf2(float a, float b) { return qfp_fcmp(a,b);} |
| 62 | +int __gtdf2(double a, double b) { return qfp_dcmp(a,b);} |
| 63 | + |
0 commit comments