<commit_before>#include <boost/math/special_functions/fpclassify.hpp>
#include "stan/math/functions/log1p.hpp"
#include <gtest/gtest.h>


TEST(MathFunctions, log1p) {
  double x;

  x = 0;
  EXPECT_FLOAT_EQ(0.0, stan::math::log1p(x));
  x = 0.0000001;
  EXPECT_FLOAT_EQ(0.0000001, stan::math::log1p(x));
  x = 0.001;
  EXPECT_FLOAT_EQ(0.0009995003, stan::math::log1p(x));
  x = 0.1;
  EXPECT_FLOAT_EQ(0.09531018, stan::math::log1p(x));
  x = 1;
  EXPECT_FLOAT_EQ(0.6931472, stan::math::log1p(x));
  x = 10;
  EXPECT_FLOAT_EQ(2.397895, stan::math::log1p(x));

  x = -0.0000001;
  EXPECT_FLOAT_EQ(-0.0000001, stan::math::log1p(x));
  x = -0.001;
  EXPECT_FLOAT_EQ(-0.0010005, stan::math::log1p(x));
  x = -0.1;
  EXPECT_FLOAT_EQ(-0.1053605, stan::math::log1p(x));
  x = -0.999;
  EXPECT_FLOAT_EQ(-6.907755, stan::math::log1p(x));
  EXPECT_FLOAT_EQ(-std::numeric_limits<double>::infinity(), stan::math::log1p(-1.0));
}

TEST(MathFunctions, log1p_exception) {
  using boost::math::isnan;
  using stan::math::log1p;
  EXPECT_TRUE(isnan(log1p(-10.0)));
}
<commit_msg>added NaN test for log1p<commit_after>#include <stan/math/functions/log1p.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
#include <gtest/gtest.h>


TEST(MathFunctions, log1p) {
  double x;

  x = 0;
  EXPECT_FLOAT_EQ(0.0, stan::math::log1p(x));
  x = 0.0000001;
  EXPECT_FLOAT_EQ(0.0000001, stan::math::log1p(x));
  x = 0.001;
  EXPECT_FLOAT_EQ(0.0009995003, stan::math::log1p(x));
  x = 0.1;
  EXPECT_FLOAT_EQ(0.09531018, stan::math::log1p(x));
  x = 1;
  EXPECT_FLOAT_EQ(0.6931472, stan::math::log1p(x));
  x = 10;
  EXPECT_FLOAT_EQ(2.397895, stan::math::log1p(x));

  x = -0.0000001;
  EXPECT_FLOAT_EQ(-0.0000001, stan::math::log1p(x));
  x = -0.001;
  EXPECT_FLOAT_EQ(-0.0010005, stan::math::log1p(x));
  x = -0.1;
  EXPECT_FLOAT_EQ(-0.1053605, stan::math::log1p(x));
  x = -0.999;
  EXPECT_FLOAT_EQ(-6.907755, stan::math::log1p(x));
  EXPECT_FLOAT_EQ(-std::numeric_limits<double>::infinity(), stan::math::log1p(-1.0));
}

TEST(MathFunctions, log1p_exception) {
  using boost::math::isnan;
  using stan::math::log1p;
  EXPECT_TRUE(isnan(log1p(-10.0)));
}

TEST(MathFunctions, log1p_nan) {
  double nan = std::numeric_limits<double>::quiet_NaN();
  
  EXPECT_PRED1(boost::math::isnan<double>,
               stan::math::log1p(nan));
}
{'fraction_non_alphanumeric': 0.2020770229337949, 'fraction_numerical': 0.11683254002596279, 'mean_word_length': 5.198391420911528, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, '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': '6429061', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1062, 'n_words': 129}