2 * MSVCRT Unix interface
4 * Copyright 2020 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #include "wine/port.h"
30 #define __USE_ISOC9X 1
31 #define __USE_ISOC99 1
38 #define WIN32_NO_STATUS
41 #include "wine/debug.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(msvcrt
);
45 /*********************************************************************
48 static double CDECL
unix_acosh(double x
)
53 if (!isfinite(x
*x
)) return log(2) + log(x
);
54 return log(x
+ sqrt(x
*x
-1));
58 /*********************************************************************
61 static float CDECL
unix_acoshf(float x
)
70 /*********************************************************************
73 static double CDECL
unix_asinh(double x
)
80 if (x
> 0) return log(2) + log(x
);
81 else return -log(2) - log(-x
);
83 return log(x
+ sqrt(x
*x
+1));
87 /*********************************************************************
90 static float CDECL
unix_asinhf(float x
)
99 /*********************************************************************
102 static double CDECL
unix_atanh(double x
)
107 if (-1e-6 < x
&& x
< 1e-6) return x
+ x
*x
*x
/3;
108 else return (log(1+x
) - log(1-x
)) / 2;
112 /*********************************************************************
115 static float CDECL
unix_atanhf(float x
)
120 return unix_atanh(x
);
124 /*********************************************************************
127 static double CDECL
unix_cosh( double x
)
132 /*********************************************************************
135 static float CDECL
unix_coshf( float x
)
140 /*********************************************************************
143 static double CDECL
unix_exp( double x
)
148 /*********************************************************************
151 static float CDECL
unix_expf( float x
)
156 /*********************************************************************
159 static double CDECL
unix_exp2( double x
)
168 /*********************************************************************
171 static float CDECL
unix_exp2f( float x
)
180 /*********************************************************************
183 static double CDECL
unix_expm1(double x
)
192 /*********************************************************************
195 static float CDECL
unix_expm1f(float x
)
204 /*********************************************************************
207 static double CDECL
unix_fma( double x
, double y
, double z
)
216 /*********************************************************************
219 static float CDECL
unix_fmaf( float x
, float y
, float z
)
222 return fmaf(x
, y
, z
);
228 /*********************************************************************
231 static double CDECL
unix_frexp( double x
, int *exp
)
233 return frexp( x
, exp
);
236 /*********************************************************************
239 static float CDECL
unix_frexpf( float x
, int *exp
)
241 return frexpf( x
, exp
);
244 /*********************************************************************
247 static double CDECL
unix_hypot(double x
, double y
)
249 return hypot( x
, y
);
252 /*********************************************************************
255 static float CDECL
unix_hypotf(float x
, float y
)
257 return hypotf( x
, y
);
260 /*********************************************************************
263 static double CDECL
unix_ldexp(double num
, int exp
)
265 return ldexp( num
, exp
);
268 /*********************************************************************
271 static double CDECL
unix_lgamma(double x
)
276 FIXME( "not implemented\n" );
281 /*********************************************************************
284 static float CDECL
unix_lgammaf(float x
)
289 FIXME( "not implemented\n" );
294 /*********************************************************************
297 static double CDECL
unix_log( double x
)
302 /*********************************************************************
305 static float CDECL
unix_logf( float x
)
310 /*********************************************************************
313 static double CDECL
unix_log10( double x
)
318 /*********************************************************************
321 static float CDECL
unix_log10f( float x
)
326 /*********************************************************************
329 static double CDECL
unix_log1p(double x
)
338 /*********************************************************************
341 static float CDECL
unix_log1pf(float x
)
350 /*********************************************************************
353 static double CDECL
unix_log2(double x
)
358 return log(x
) / log(2);
362 /*********************************************************************
365 static float CDECL
unix_log2f(float x
)
374 /*********************************************************************
377 static double CDECL
unix_pow( double x
, double y
)
382 /*********************************************************************
385 static float CDECL
unix_powf( float x
, float y
)
390 /*********************************************************************
393 static float CDECL
unix_sinf( float x
)
398 /*********************************************************************
401 static double CDECL
unix_sinh( double x
)
406 /*********************************************************************
409 static float CDECL
unix_sinhf( float x
)
414 /*********************************************************************
417 static float CDECL
unix_tanf( float x
)
422 /*********************************************************************
425 static double CDECL
unix_tanh( double x
)
430 /*********************************************************************
433 static float CDECL
unix_tanhf( float x
)
438 /*********************************************************************
441 static double CDECL
unix_tgamma(double x
)
446 FIXME( "not implemented\n" );
451 /*********************************************************************
454 static float CDECL
unix_tgammaf(float x
)
459 FIXME( "not implemented\n" );
464 static const struct unix_funcs funcs
=
509 NTSTATUS CDECL
__wine_init_unix_lib( HMODULE module
, DWORD reason
, const void *ptr_in
, void *ptr_out
)
511 if (reason
!= DLL_PROCESS_ATTACH
) return STATUS_SUCCESS
;
513 *(const struct unix_funcs
**)ptr_out
= &funcs
;
514 return STATUS_SUCCESS
;