1 /*
2 * Copyright (c) 2022 Winner Microelectronics Co., Ltd. All rights reserved.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "libm.h"
17 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
fabsl(long double x)18 long double fabsl(long double x)
19 {
20 return fabs(x);
21 }
22 #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
fabsl(long double x)23 long double fabsl(long double x)
24 {
25 union ldshape u = {x};
26
27 u.i.se &= 0x7fff;
28 return u.f;
29 }
30 #endif
31