<commit_before>#ifndef NUMBER_H
#define NUMBER_H

#include <stdint.h>
#include <string>

#define NUMBER_DECIMAL

// The Number type is defined as a struct below (containing a member
// of the actual numeric type) so that the rest of the code doesn't
// accidentally use regular arithmetic operations on these numeric
// values.

#if defined(NUMBER_DOUBLE)

struct Number {
    Number(): x(0) {}
    Number(double x): x(x) {}
    double x;
};

#elif defined(NUMBER_DECIMAL)

#define DECIMAL_GLOBAL_ROUNDING 1
#define DECIMAL_GLOBAL_EXCEPTION_FLAGS 1

#ifndef _WCHAR_T_DEFINED
#define _WCHAR_T_DEFINED
#endif
#include "bid_conf.h"
#ifdef _MSC_VER
#pragma warning(push, 0)
#endif
#include "bid_functions.h"
#ifdef _MSC_VER
#pragma warning(pop)
#endif

struct Number {
    Number(): x(0) {} // TODO: use whatever proper zero constant is appropriate
    Number(BID_UINT64 x): x(x) {}
    BID_UINT64 x;
};

#else

#error Must define NUMBER_DOUBLE or NUMBER_DECIMAL

#endif

Number number_add(Number x, Number y);
Number number_subtract(Number x, Number y);
Number number_multiply(Number x, Number y);
Number number_divide(Number x, Number y);
Number number_modulo(Number x, Number y);
Number number_pow(Number x, Number y);
Number number_negate(Number x);
Number number_abs(Number x);
Number number_ceil(Number x);
Number number_floor(Number x);
Number number_exp(Number x);<commit_msg>initialize Number to zero properly<commit_after>#ifndef NUMBER_H
#define NUMBER_H

#include <stdint.h>
#include <string>

#define NUMBER_DECIMAL

// The Number type is defined as a struct below (containing a member
// of the actual numeric type) so that the rest of the code doesn't
// accidentally use regular arithmetic operations on these numeric
// values.

#if defined(NUMBER_DOUBLE)

struct Number {
    Number(): x(0) {}
    Number(double x): x(x) {}
    double x;
};

#elif defined(NUMBER_DECIMAL)

#define DECIMAL_GLOBAL_ROUNDING 1
#define DECIMAL_GLOBAL_EXCEPTION_FLAGS 1

#ifndef _WCHAR_T_DEFINED
#define _WCHAR_T_DEFINED
#endif
#include "bid_conf.h"
#ifdef _MSC_VER
#pragma warning(push, 0)
#endif
#include "bid_functions.h"
#ifdef _MSC_VER
#pragma warning(pop)
#endif

struct Number {
    Number(): x(bid64_from_uint32(0)) {}
    Number(BID_UINT64 x): x(x) {}
    BID_UINT64 x;
};

#else

#error Must define NUMBER_DOUBLE or NUMBER_DECIMAL

#endif

Number number_add(Number x, Number y);
Number number_subtract(Number x, Number y);
Number number_multiply(Number x, Number y);
Number number_divide(Number x, Number y);
Number number_modulo(Number x, Number y);
Number number_pow(Number x, Number y);
Number number_negate(Number x);
Number number_abs(Number x);
Number number_ceil(Number x);
Number number_floor(Number x);
Number number_exp(Number x);
{'fraction_non_alphanumeric': 0.0988329686360321, 'fraction_numerical': 0.008023340627279359, 'mean_word_length': 5.438967136150235, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7158642', 'n_tokens_mistral': 967, 'n_tokens_neox': 926, 'n_words': 301}