[sw] float_test: fix rounding

use round to nearby integral
This commit is contained in:
stnolting 2024-02-11 15:25:57 +01:00
parent 36ae947c32
commit 36ae41d5b3

View file

@ -6,7 +6,7 @@
// # ********************************************************************************************* #
// # BSD 3-Clause License #
// # #
// # Copyright (c) 2022, Stephan Nolting. All rights reserved. #
// # Copyright (c) 2024, Stephan Nolting. All rights reserved. #
// # #
// # Redistribution and use in source and binary forms, with or without modification, are #
// # permitted provided that the following conditions are met: #
@ -670,7 +670,7 @@ uint32_t __attribute__ ((noinline)) riscv_emulate_fcvt_wus(float rs1) {
float opa = subnormal_flush(rs1);
return (uint32_t)roundf(opa);
return (uint32_t)rint(opa);
}
@ -684,7 +684,7 @@ int32_t __attribute__ ((noinline)) riscv_emulate_fcvt_ws(float rs1) {
float opa = subnormal_flush(rs1);
return (int32_t)roundf(opa);
return (int32_t)rint(opa);
}