Skip to content

Commit 5a984bd

Browse files
authored
Merge pull request #107 from isuruf/rint
Fix incorrect rounding behavior
2 parents 6267276 + 1e23919 commit 5a984bd

File tree

3 files changed

+4
-16
lines changed

3 files changed

+4
-16
lines changed

runtime/flangrti/around.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@
1616
*/
1717

1818
#include "mthdecls.h"
19-
20-
extern float roundf(float);
19+
#include <math.h>
2120

2221
float
2322
__mth_i_around(float x)
2423
{
25-
return roundf(x);
24+
return rintf(x);
2625
}

runtime/flangrti/dround.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@
1616
*/
1717

1818
#include "mthdecls.h"
19-
20-
extern double round(double);
19+
#include <math.h>
2120

2221
double
2322
__mth_i_dround(double x)
2423
{
25-
return round(x);
24+
return rint(x);
2625
}

runtime/flangrti/fltmanip.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -359,16 +359,6 @@ nearbyintf(float x)
359359
return __nearbyintf(x);
360360
}
361361
double
362-
rint(double x)
363-
{
364-
return __nearbyint(x);
365-
}
366-
float
367-
rintf(float x)
368-
{
369-
return __nearbyintf(x);
370-
}
371-
double
372362
remainder(double x, double y)
373363
{
374364
return __remainder(x, y);

0 commit comments

Comments
 (0)