diff --git a/core/libs/prx/libc/src/Math.cpp b/core/libs/prx/libc/src/Math.cpp index 154bfa5aeb06..3a54e453fa2e 100644 --- a/core/libs/prx/libc/src/Math.cpp +++ b/core/libs/prx/libc/src/Math.cpp @@ -248,6 +248,9 @@ double APS5_VABI expm1_nid_postfix(double x) { return std::expm1(x); } float APS5_VABI expm1f_nid_postfix(float x) { return std::expm1(x); } float APS5_VABI erff_nid_postfix(float x) { return std::erf(x); } double APS5_VABI lgamma_nid_postfix(double x) { return std::lgamma(x); } +float APS5_VABI lgammaf_nid_postfix(float x) { return std::lgamma(x); } +double APS5_VABI tgamma_nid_postfix(double x) { return std::tgamma(x); } +float APS5_VABI tgammaf_nid_postfix(float x) { return std::tgamma(x); } float APS5_VABI sinf_nid_postfix(float x) { return std::sin(x); } float APS5_VABI cosf_nid_postfix(float x) { return std::cos(x); } diff --git a/core/libs/tests/GuestMath.cpp b/core/libs/tests/GuestMath.cpp index 103c6e5bd176..d2ecff7ff0df 100644 --- a/core/libs/tests/GuestMath.cpp +++ b/core/libs/tests/GuestMath.cpp @@ -65,6 +65,9 @@ double APS5_VABI expm1_nid_postfix(double); float APS5_VABI expm1f_nid_postfix(float); float APS5_VABI erff_nid_postfix(float); double APS5_VABI lgamma_nid_postfix(double); +float APS5_VABI lgammaf_nid_postfix(float); +double APS5_VABI tgamma_nid_postfix(double); +float APS5_VABI tgammaf_nid_postfix(float); float APS5_VABI logbf_nid_postfix(float); double APS5_VABI exp2_nid_postfix(double); float APS5_VABI __powisf2_nid_postfix(float, int); @@ -711,6 +714,13 @@ int main() { Require(lgamma_nid_postfix(1.) == 0. && lgamma_nid_postfix(2.) == 0. && std::isinf(lgamma_nid_postfix(0.))); Require(std::abs(lgamma_nid_postfix(0.5) - 0.5723649429247001) < 1e-15 && std::abs(lgamma_nid_postfix(10.) - 12.801827480081469) < 1e-13); Require(std::abs(lgamma_nid_postfix(-0.5) - 1.2655121234846454) < 1e-15); + Require(lgammaf_nid_postfix(1.f) == 0.f && lgammaf_nid_postfix(2.f) == 0.f && std::isinf(lgammaf_nid_postfix(0.f))); + Require(std::abs(lgammaf_nid_postfix(0.5f) - 0.57236494f) < 1e-6f && std::abs(lgammaf_nid_postfix(10.f) - 12.801827f) < 1e-4f); + Require(std::abs(lgammaf_nid_postfix(-0.5f) - 1.2655121f) < 1e-6f); + Require(tgamma_nid_postfix(1.) == 1. && tgamma_nid_postfix(2.) == 1. && tgamma_nid_postfix(3.) == 2. && tgamma_nid_postfix(4.) == 6.); + Require(std::abs(tgamma_nid_postfix(0.5) - 1.772453850905516) < 1e-15 && std::isnan(tgamma_nid_postfix(-1.))); + Require(tgammaf_nid_postfix(1.f) == 1.f && tgammaf_nid_postfix(2.f) == 1.f && tgammaf_nid_postfix(3.f) == 2.f && tgammaf_nid_postfix(4.f) == 6.f); + Require(std::abs(tgammaf_nid_postfix(0.5f) - 1.7724538f) < 1e-6f && std::isnan(tgammaf_nid_postfix(-1.f))); Require(llroundl_nid_postfix(2.5L) == 3 && llroundl_nid_postfix(-2.5L) == -3 && llroundl_nid_postfix(0.49999999999999999L) == 0); Require(llroundl_nid_postfix(9007199254740993.0L) == 9007199254740993LL && llroundl_nid_postfix(-1e30L) == INT64_MIN); Require(logbf_nid_postfix(8.f) == 3.f && logbf_nid_postfix(-0.75f) == -1.f);