<commit_before>// This file is part of Metallic, a runtime library for WebAssembly.
//
// Copyright (C) 2017 <NAME> <<EMAIL>>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/

#ifndef _TGMATH_H
#define _TGMATH_H

#include <math.h>
#include <complex.h>

#if __STDC_VERSION__ >= 201112L
#define _TGMATH(x, function) _Generic(x, \
    float: function##f,                  \
    default: function,                   \
    long double: function##l,            \
    float _Complex: c##function##f,      \
    double _Complex: c##function,        \
    long double _Complex: c##function##l \
)
#define _TGMATH_COMPLEX(x, function) _Generic((x + _Complex_I), \
    float _Complex: function##f,                                \
    default: function,                                          \
    long double _Complex: function##l                           \
)
#define fabs(x) _Generic(x,     \
    float: fabsf,               \
    default: fabs,              \
    long double: fabsl,         \
    float _Complex: cabsf,      \
    double _Complex: cabs,      \
    long double _Complex: cabsl \
)
#else
#define _TGMATH(x, function) __builtin_choose_expr(                                                     \
    __builtin_types_compatible_p(__typeof__(x), float), function##f, __builtin_choose_expr(             \
    __builtin_types_compatible_p(__typeof__(x), long double), function##l, __builtin_choose_expr(       \
    __builtin_types_compatible_p(__typeof__(x), float _Complex), c##function##f, __builtin_choose_expr( \
    __builtin_types_compatible_p(__typeof__(x), double _Complex), c##function, __builtin_choose_expr(   \
    __builtin_types_compatible_p(__typeof__(x), long double _Complex), c##function##l, function         \
)))))
#define _TGMATH_COMPLEX(x, function) __builtin_choose_expr(                                                       \
    __builtin_types_compatible_p(__typeof__(x + _Complex_I), float _Complex), function##f, __builtin_choose_expr( \
    __builtin_types_compatible_p(__typeof__(x + _Complex_I), long double _Complex), function##l, function         \
))
#define fabs(x) __builtin_choose_expr(                                                         \
    __builtin_types_compatible_p(__typeof__(x), float), fabsf, __builtin_choose_expr(          \
    __builtin_types_compatible_p(__typeof__(x), long double), fabsl, __builtin_choose_expr(    \
    __builtin_types_compatible_p(__typeof__(x), float _Complex), cabsf, __builtin_choose_expr( \
    __builtin_types_compatible_p(__typeof__(x), double _Complex), cabs, __builtin_choose_expr( \
    __builtin_types_compatible_p(__typeof__(x), long double _Complex), cabsl, fabs             \
)))))
#endif

#define exp(x) _TGMATH(x, exp)(x)
#define log(x) _TGMATH(x, log)(x)
#define pow(x, y) _TGMATH((x)*(y), pow)(x, y)
#define sqrt(x) _TGMATH(x, sqrt)(x)
#define sin(x) _TGMATH(x, sin)(x)
#define cos(x) _TGMATH(x, cos)(x)
#define tan(x) _TGMATH(x, tan)(x)
#define asin(x) _TGMATH(x, asin)(x)
#define acos(x) _TGMATH(x, acos)(x)
#define atan(x) _TGMATH(x, atan)(x)<commit_msg>Fix fabs macro in tgmath.h<commit_after>// This file is part of Metallic, a runtime library for WebAssembly.
//
// Copyright (C) 2017 <NAME> <<EMAIL>>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/

#ifndef _TGMATH_H
#define _TGMATH_H

#include <math.h>
#include <complex.h>

#if __STDC_VERSION__ >= 201112L
#define _TGMATH(x, function) _Generic(x, \
    float: function##f,                  \
    default: function,                   \
    long double: function##l,            \
    float _Complex: c##function##f,      \
    double _Complex: c##function,        \
    long double _Complex: c##function##l \
)
#define _TGMATH_COMPLEX(x, function) _Generic((x + _Complex_I), \
    float _Complex: function##f,                                \
    default: function,                                          \
    long double _Complex: function##l                           \
)
#define fabs(x) _Generic(x,     \
    float: fabsf,               \
    default: fabs,              \
    long double: fabsl,         \
    float _Complex: cabsf,      \
    double _Complex: cabs,      \
    long double _Complex: cabsl \
)(x)
#else
#define _TGMATH(x, function) __builtin_choose_expr(                                                     \
    __builtin_types_compatible_p(__typeof__(x), float), function##f, __builtin_choose_expr(             \
    __builtin_types_compatible_p(__typeof__(x), long double), function##l, __builtin_choose_expr(       \
    __builtin_types_compatible_p(__typeof__(x), float _Complex), c##function##f, __builtin_choose_expr( \
    __builtin_types_compatible_p(__typeof__(x), double _Complex), c##function, __builtin_choose_expr(   \
    __builtin_types_compatible_p(__typeof__(x), long double _Complex), c##function##l, function         \
)))))(x)
#define _TGMATH_COMPLEX(x, function) __builtin_choose_expr(                                                       \
    __builtin_types_compatible_p(__typeof__(x + _Complex_I), float _Complex), function##f, __builtin_choose_expr( \
    __builtin_types_compatible_p(__typeof__(x + _Complex_I), long double _Complex), function##l, function         \
))(x)
#define fabs(x) __builtin_choose_expr(                                                         \
    __builtin_types_compatible_p(__typeof__(x), float), fabsf, __builtin_choose_expr(          \
    __builtin_types_compatible_p(__typeof__(x), long double), fabsl, __builtin_choose_expr(    \
    __builtin_types_compatible_p(__typeof__(x), float _Complex), cabsf, __builtin_choose_expr( \
    __builtin_types_compatible_p(__typeof__(x), double _Complex), cabs, __builtin_choose_expr( \
    __builtin_types_compatible_p(__typeof__(x), long double _Complex), cabsl, fabs             \
)))))(x)
#endif

#define exp(x) _TGMATH(x, exp)(x)
#define log(x) _TGMATH(x, log)(x)
#define pow(x, y) _TGMATH((x)*(y), pow)(x, y)
#define sqrt(x) _TGMATH(x, sqrt)(x)
#define sin(x) _TGMATH(x, sin)(x)
#define cos(x) _TGMATH(x, cos)(x)
#define tan(x) _TGMATH(x, tan)(x)
#define asin(x) _TGMATH(x, asin)(x)
#define acos(x) _TGMATH(x, acos)(x)
#define atan(x) _TGMATH(x, atan)(x)
{'fraction_non_alphanumeric': 0.1194793119479312, 'fraction_numerical': 0.004339067100573377, 'mean_word_length': 2.6463276836158194, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1406974', 'n_tokens_mistral': 2115, 'n_tokens_neox': 2097, 'n_words': 477}