<commit_before>#ifndef _TCUINTERVAL_HPP
#define _TCUINTERVAL_HPP
/*-------------------------------------------------------------------------
 * drawElements Quality Program Tester Core
 * ----------------------------------------
 *
 * Copyright 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *//*!
 * \file
 * \brief Interval arithmetic and floating point precisions.
 *//*--------------------------------------------------------------------*/

#include "tcuDefs.hpp"

#include "deMath.h"

#include <iostream>
#include <limits>

#define TCU_INFINITY	(::std::numeric_limits<float>::infinity())
#define TCU_NAN			(::std::numeric_limits<float>::quiet_NaN())

namespace tcu
{

// RAII context for temporarily changing the rounding mode
class ScopedRoundingMode
{
public:
							ScopedRoundingMode	(deRoundingMode mode)
								: m_oldMode (deGetRoundingMode()) { deSetRoundingMode(mode); }

							ScopedRoundingMode	(void) : m_oldMode (deGetRoundingMode()) {}

							~ScopedRoundingMode	(void)	{ deSetRoundingMode(m_oldMode); }

private:
							ScopedRoundingMode	(const ScopedRoundingMode&);
	ScopedRoundingMode&		operator=			(const ScopedRoundingMode&);

	const deRoundingMode	m_oldMode;
};

class Interval
{
public:
				// Empty interval.
				Interval			(void)
					: m_hasNaN		(false)
					, m_lo			(TCU_INFINITY)
					, m_hi			(-TCU_INFINITY)
					, m_warningLo	(-TCU_INFINITY)
					, m_warningHi	(TCU_INFINITY) {}

				// Intentionally not explicit. Conversion from double to Interval is common
				// and reasonable.
				Interval			(double val)
					: m_hasNaN		(!!deIsNaN(val))
					, m_lo			(m_hasNaN ? TCU_INFINITY : val)
					, m_hi			(m_hasNaN ? -TCU_INFINITY : val)
					, m_warningLo	(-TCU_INFINITY)
					, m_warningHi	(TCU_INFINITY) {}


				Interval(bool hasNaN_, double lo_, double hi_)
					: m_hasNaN(hasNaN_), m_lo(lo_), m_hi(hi_), m_warningLo(-TCU_INFINITY), m_warningHi(TCU_INFINITY) {}

				Interval(bool hasNaN_, double lo_, double hi_, double wlo_, double whi_)
					: m_hasNaN(hasNaN_), m_lo(lo_), m_hi(hi_), m_warningLo(wlo_), m_warningHi(whi_) {}

				Interval		(const Interval& a, const Interval& b)
					: m_hasNaN		(a.m_hasNaN || b.m_hasNaN)
					, m_lo			(de::min(a.lo(), b.lo()))
					, m_hi			(de::max(a.hi(), b.hi()))
					, m_warningLo	(de::min(a.warningLo(), b.warningLo()))
					, m_warningHi	(de::max(a.warningHi(), b.warningHi())) {}

	double		length			(void) const { return m_hi - m_lo; }
	double		lo				(void) const { return m_lo; }
	double		hi				(void) const { return m_hi; }
	double		warningLo		(void) const { return m_warningLo; }
	double		warningHi		(void) const { return m_warningHi; }
	bool		hasNaN			(void) const { return m_hasNaN; }
	Interval	nan				(void) const { return m_hasNaN ? TCU_NAN : Interval(); }
	bool		empty			(void) const { return m_lo > m_hi; }
	bool		isFinite		(void) const { return m_lo > -TCU_INFINITY && m_hi < TCU_INFINITY; }
	bool		isOrdinary		(void) const { return !hasNaN() && !empty() && isFinite(); }

	void		warning			(double lo, double hi)
	{
		m_warningLo = lo;
		m_warningHi = hi;
	}
<commit_msg>Rename Interval::warning's parameters to avoid shadowing<commit_after>#ifndef _TCUINTERVAL_HPP
#define _TCUINTERVAL_HPP
/*-------------------------------------------------------------------------
 * drawElements Quality Program Tester Core
 * ----------------------------------------
 *
 * Copyright 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *//*!
 * \file
 * \brief Interval arithmetic and floating point precisions.
 *//*--------------------------------------------------------------------*/

#include "tcuDefs.hpp"

#include "deMath.h"

#include <iostream>
#include <limits>

#define TCU_INFINITY	(::std::numeric_limits<float>::infinity())
#define TCU_NAN			(::std::numeric_limits<float>::quiet_NaN())

namespace tcu
{

// RAII context for temporarily changing the rounding mode
class ScopedRoundingMode
{
public:
							ScopedRoundingMode	(deRoundingMode mode)
								: m_oldMode (deGetRoundingMode()) { deSetRoundingMode(mode); }

							ScopedRoundingMode	(void) : m_oldMode (deGetRoundingMode()) {}

							~ScopedRoundingMode	(void)	{ deSetRoundingMode(m_oldMode); }

private:
							ScopedRoundingMode	(const ScopedRoundingMode&);
	ScopedRoundingMode&		operator=			(const ScopedRoundingMode&);

	const deRoundingMode	m_oldMode;
};

class Interval
{
public:
				// Empty interval.
				Interval			(void)
					: m_hasNaN		(false)
					, m_lo			(TCU_INFINITY)
					, m_hi			(-TCU_INFINITY)
					, m_warningLo	(-TCU_INFINITY)
					, m_warningHi	(TCU_INFINITY) {}

				// Intentionally not explicit. Conversion from double to Interval is common
				// and reasonable.
				Interval			(double val)
					: m_hasNaN		(!!deIsNaN(val))
					, m_lo			(m_hasNaN ? TCU_INFINITY : val)
					, m_hi			(m_hasNaN ? -TCU_INFINITY : val)
					, m_warningLo	(-TCU_INFINITY)
					, m_warningHi	(TCU_INFINITY) {}


				Interval(bool hasNaN_, double lo_, double hi_)
					: m_hasNaN(hasNaN_), m_lo(lo_), m_hi(hi_), m_warningLo(-TCU_INFINITY), m_warningHi(TCU_INFINITY) {}

				Interval(bool hasNaN_, double lo_, double hi_, double wlo_, double whi_)
					: m_hasNaN(hasNaN_), m_lo(lo_), m_hi(hi_), m_warningLo(wlo_), m_warningHi(whi_) {}

				Interval		(const Interval& a, const Interval& b)
					: m_hasNaN		(a.m_hasNaN || b.m_hasNaN)
					, m_lo			(de::min(a.lo(), b.lo()))
					, m_hi			(de::max(a.hi(), b.hi()))
					, m_warningLo	(de::min(a.warningLo(), b.warningLo()))
					, m_warningHi	(de::max(a.warningHi(), b.warningHi())) {}

	double		length			(void) const { return m_hi - m_lo; }
	double		lo				(void) const { return m_lo; }
	double		hi				(void) const { return m_hi; }
	double		warningLo		(void) const { return m_warningLo; }
	double		warningHi		(void) const { return m_warningHi; }
	bool		hasNaN			(void) const { return m_hasNaN; }
	Interval	nan				(void) const { return m_hasNaN ? TCU_NAN : Interval(); }
	bool		empty			(void) const { return m_lo > m_hi; }
	bool		isFinite		(void) const { return m_lo > -TCU_INFINITY && m_hi < TCU_INFINITY; }
	bool		isOrdinary		(void) const { return !hasNaN() && !empty() && isFinite(); }

	void		warning			(double lo_, double hi_)
	{
		m_warningLo = lo_;
		m_warningHi = hi_;
	}

{'fraction_non_alphanumeric': 0.16235100698725852, 'fraction_numerical': 0.002192081107000959, 'mean_word_length': 2.920515574650913, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2341238', 'n_tokens_mistral': 2857, 'n_tokens_neox': 2523, 'n_words': 657}