<commit_before>package com.asher_stern.crf.utilities;

/**
 * 
 *
 * <p>
 * Date: Oct 15, 2016
 * @author <NAME>
 *
 */
public class DoubleUtilities
{
	public static double safeAdd(double d1, final double d2)
	{
		if (Double.isNaN(d1)) {throw new CrfException("Unexpected NaN double variable.");}
		if (Double.isNaN(d2)) {throw new CrfException("Unexpected NaN double variable.");}
		
		double ret = d1+d2;
		if (Double.isNaN(ret)) {throw new CrfException("Unexpected NaN double variable.");}
		ret = infinityToMaxDouble(ret);
		return ret;
	}
	
	public static double safeSubtract(double d1, final double d2)
	{
		d1 = -d1;
		return safeAdd(d1, d2);
	}
	
	public static double safeMultiply(double d1, double d2)
	{<commit_msg>Fix bug<commit_after>package com.asher_stern.crf.utilities;

/**
 * 
 *
 * <p>
 * Date: Oct 15, 2016
 * @author <NAME>
 *
 */
public class DoubleUtilities
{
	public static double safeAdd(double d1, final double d2)
	{
		if (Double.isNaN(d1)) {throw new CrfException("Unexpected NaN double variable.");}
		if (Double.isNaN(d2)) {throw new CrfException("Unexpected NaN double variable.");}
		
		double ret = d1+d2;
		if (Double.isNaN(ret)) {throw new CrfException("Unexpected NaN double variable.");}
		ret = infinityToMaxDouble(ret);
		return ret;
	}
	
	public static double safeSubtract(double d1, double d2)
	{
		d2 = -d2;
		return safeAdd(d1, d2);
	}
	
	public static double safeMultiply(double d1, double d2)
	{
{'fraction_non_alphanumeric': 0.13055555555555556, 'fraction_numerical': 0.027777777777777776, 'mean_word_length': 4.164874551971326, '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': '4740021', 'n_tokens_mistral': 555, 'n_tokens_neox': 500, 'n_words': 142}