<commit_before>/*
 * fuzz.h
 *
 * Part of librfn (a general utility library from redfelineninja.org.uk)
 *
 * Copyright (C) 2012 <NAME> <<EMAIL>> 
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#ifndef RF_FUZZ_H_
#define RF_FUZZ_H_

int fuzzcmp(double a, double b, double delta);
int fuzzcmpf(float a, float b, float delta);

int fuzzcmpb(double a, double b, int bits);
int fuzzcmpbf(float a, float b, int bits);

#endif // RF_FUZZ_H_<commit_msg>librfn/fuzz: Add asserteq() for approximate equality checking<commit_after>/*
 * fuzz.h
 *
 * Part of librfn (a general utility library from redfelineninja.org.uk)
 *
 * Copyright (C) 2012 <NAME> <<EMAIL>> 
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#ifndef RF_FUZZ_H_
#define RF_FUZZ_H_

#include <assert.h>

int fuzzcmp(double a, double b, double delta);
int fuzzcmpf(float a, float b, float delta);

int fuzzcmpb(double a, double b, int bits);
int fuzzcmpbf(float a, float b, int bits);

/*! Assert two values are approximately equal.
 *
 * Currently this checks the values differ by no more than 10 parts
 * per million.
 */
#define asserteq(a, b) assert(fuzzcmp(a, b, 1.000010))

#endif // RF_FUZZ_H_
{'fraction_non_alphanumeric': 0.0967741935483871, 'fraction_numerical': 0.012017710309930424, 'mean_word_length': 4.153094462540716, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, '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': '6938284', 'n_tokens_mistral': 541, 'n_tokens_neox': 511, 'n_words': 215}