@@ -26,6 +26,7 @@ extern "C" {
26
26
pub fn tgamma ( n : f64 ) -> f64 ;
27
27
pub fn tgammaf ( n : f32 ) -> f32 ;
28
28
pub fn lgamma_r ( n : f64 , s : & mut i32 ) -> f64 ;
29
+ #[ cfg( not( target_os = "aix" ) ) ]
29
30
pub fn lgammaf_r ( n : f32 , s : & mut i32 ) -> f32 ;
30
31
31
32
pub fn acosf128 ( n : f128 ) -> f128 ;
@@ -56,13 +57,20 @@ extern "C" {
56
57
} }
57
58
}
58
59
60
+ // On AIX, we don't have lgammaf_r only the f64 version, so we can
61
+ // use the f64 version lgamma_r
62
+ #[ cfg( target_os = "aix" ) ]
63
+ pub unsafe fn lgammaf_r ( n : f32 , s : & mut i32 ) -> f32 {
64
+ lgamma_r ( n. into ( ) , s) as f32
65
+ }
66
+
59
67
// On 32-bit x86 MSVC these functions aren't defined, so we just define shims
60
68
// which promote everything to f64, perform the calculation, and then demote
61
69
// back to f32. While not precisely correct should be "correct enough" for now.
62
70
cfg_if:: cfg_if! {
63
71
if #[ cfg( all( target_os = "windows" , target_env = "msvc" , target_arch = "x86" ) ) ] {
64
72
#[ inline]
65
- pub unsafe fn acosf( n: f32 ) -> f32 {
73
+ pub unsafe fn acosf( n: f32 ) -> f32 {
66
74
f64 :: acos( n as f64 ) as f32
67
75
}
68
76
0 commit comments