msvcrt: Import lroundf implementation from musl.
[wine.git] / dlls / msvcrt / mathf.c
blob4038bdb4cf7a9bfcbc17707437dfb17a8425dd97
1 /*
2 * msvcrt float functions
4 * Copyright 2019 Jacek Caban for CodeWeavers
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
21 /* this function is part of the import lib to provide floating */
22 #if 0
23 #pragma makedep implib
24 #endif
26 #include <corecrt.h>
27 #include <wine/asm.h>
29 double __cdecl sin(double);
30 double __cdecl cos(double);
31 double __cdecl tan(double);
32 double __cdecl atan2(double, double);
33 double __cdecl exp(double);
34 double __cdecl log(double);
35 double __cdecl pow(double, double);
36 double __cdecl sqrt(double);
37 double __cdecl floor(double);
38 double __cdecl ceil(double);
39 float __cdecl powf(float, float);
41 #if defined(__i386__) || (_MSVCR_VER > 0 && _MSVCR_VER < 80)
42 float sinf(float x) { return sin(x); }
43 float cosf(float x) { return cos(x); }
44 float tanf(float x) { return tan(x); }
45 float atan2f(float x, float y) { return atan2(x, y); }
46 float expf(float x) { return exp(x); }
47 float logf(float x) { return log(x); }
48 float powf(float x, float y) { return pow(x, y); }
49 float sqrtf(float x) { return sqrt(x); }
50 float floorf(float x) { return floor(x); }
51 float ceilf(float x) { return ceil(x); }
52 __ASM_GLOBAL_IMPORT(sinf)
53 __ASM_GLOBAL_IMPORT(cosf)
54 __ASM_GLOBAL_IMPORT(tanf)
55 __ASM_GLOBAL_IMPORT(atan2f)
56 __ASM_GLOBAL_IMPORT(expf)
57 __ASM_GLOBAL_IMPORT(logf)
58 __ASM_GLOBAL_IMPORT(powf)
59 __ASM_GLOBAL_IMPORT(sqrtf)
60 __ASM_GLOBAL_IMPORT(floorf)
61 __ASM_GLOBAL_IMPORT(ceilf)
62 #endif
64 #if _MSVCR_VER < 120
65 double exp2(double x) { return pow(2.0, x); }
66 float exp2f(float x) { return powf(2.0f, x); }
67 __ASM_GLOBAL_IMPORT(exp2)
68 __ASM_GLOBAL_IMPORT(exp2f)
69 #endif