<commit_before>/* $Id$ */

/*
 * Copyright (C) 2006-2007, The Perl Foundation.
 */

/*
 * math stuff
 */

/*
 * force atan2() to use IEEE behavior
 */

#include <math.h>

_LIB_VERSION_TYPE _LIB_VERSION = _IEEE_;

/*
 * return true if the Numval has a negative sign.
 * This is mostly for handling the -0.0 case.
 *
 * Parrot_signbit is exported because PerlNum.set_number_native() uses it.
 * XXX: This is probably not a good reason.
 */
#if DOUBLE_SIZE == 2 * INT_SIZE
PARROT_API extern int
Parrot_signbit(double x)
{
    union {
        double d;
        int i[2];
    } u;
    u.d = x;
#  if PARROT_BIGENDIAN
    return u.i[0] < 0;
#  else
    return u.i[1] < 0;
#  endif
}
#endif

#if NUMVAL_SIZE == 12 && DOUBLE_SIZE == 3 * INT_SIZE && PARROT_LITTLE_ENDIAN
int
Parrot_signbit_l(long double x)
{
    union {
        long double d;
        int i[3];
    } u;
    u.d = x;
    return u.i[2] < 0;
}
#endif

/*
 * Local variables:
 *   c-file-style: "parrot"
 * End:
 * vim: expandtab shiftwidth=4:
 */<commit_msg>[config, netbsd] Updated function documentation<commit_after>/* $Id$ */

/*
 * Copyright (C) 2006-2007, The Perl Foundation.
 */

/*

=head1 NAME

math.c

=head1 DESCRIPTION

math stuff

=head2 Functions

=over 4

=cut

*/

/*
 * force atan2() to use IEEE behavior
 */

#include <math.h>

_LIB_VERSION_TYPE _LIB_VERSION = _IEEE_;

#if DOUBLE_SIZE == 2 * INT_SIZE
/*

=item C<PARROT_API extern int
Parrot_signbit(double x)>

return true if the Numval has a negative sign.
This is mostly for handling the -0.0 case.

Parrot_signbit is exported because PerlNum.set_number_native() uses it.
XXX: This is probably not a good reason.

=cut

*/

PARROT_API extern int
Parrot_signbit(double x)
{
    union {
        double d;
        int i[2];
    } u;
    u.d = x;
#  if PARROT_BIGENDIAN
    return u.i[0] < 0;
#  else
    return u.i[1] < 0;
#  endif
}
#endif

#if NUMVAL_SIZE == 12 && DOUBLE_SIZE == 3 * INT_SIZE && PARROT_LITTLE_ENDIAN
/*

=item C<int
Parrot_signbit_l(long double x)>

TODO: Not yet documented!!!

=cut

*/

int
Parrot_signbit_l(long double x)
{
    union {
        long double d;
        int i[3];
    } u;
    u.d = x;
    return u.i[2] < 0;
}
#endif

/*

=back

=cut

*/

/*
 * Local variables:
 *   c-file-style: "parrot"
 * End:
 * vim: expandtab shiftwidth=4:
 */
{'fraction_non_alphanumeric': 0.13115468409586056, 'fraction_numerical': 0.022657952069716776, 'mean_word_length': 2.6794871794871793, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5276817', 'n_tokens_mistral': 968, 'n_tokens_neox': 911, 'n_words': 259}