<commit_before>/**********************************************************************
 * $Id$
 *
 * GEOS - Geometry Engine Open Source
 * http://geos.refractions.net
 *
 * Copyright (C) 2001-2002 Vivid Solutions Inc.
 *
 * This is free software; you can redistribute and/or modify it under
 * the terms of the GNU Lesser General Public Licence as published
 * by the Free Software Foundation. 
 * See the COPYING file for more information.
 *
 **********************************************************************
 * $Log$
 * Revision 1.26  2004/07/05 14:23:03  strk
 * More documentation cleanups.
 *
 * Revision 1.25  2004/07/03 12:51:37  strk
 * Documentation cleanups for DoxyGen.
 *
 * Revision 1.24  2004/07/02 13:28:26  strk
 * Fixed all #include lines to reflect headers layout change.
 * Added client application build tips in README.
 *
 * Revision 1.23  2004/05/28 18:16:01  ybychkov
 * Changed rounding method to make compilable with VC++
 *
 * Revision 1.22  2004/05/21 13:39:31  strk
 * ::makePrecise make use of nearbyint() now, to be compatible with JTS
 *
 * Revision 1.21  2004/05/19 19:39:05  ybychkov
 * Changed rounding method to make compilable with VC++
 *
 * Revision 1.20  2004/05/17 10:45:58  strk
 * Fixed bogus FIXED coordinate rounding
 *
 * Revision 1.19  2004/04/16 07:42:06  strk
 * PrecisionModel::Type made an enum instead of a Type.
 *
 * Revision 1.18  2004/04/14 09:38:10  strk
 * PrecisionModel(double newScale) missed to set the scale
 *
 * Revision 1.17  2004/03/31 07:50:37  ybychkov
 * "geom" partially upgraded to JTS 1.4
 *
 * Revision 1.16  2003/11/12 17:15:05  strk
 * made sure PrecisionModel scale is never 0
 *
 * Revision 1.15  2003/11/07 01:23:42  pramsey
 * Add standard CVS headers licence notices and copyrights to all cpp and h
 * files.
 *
 * Revision 1.14  2003/10/11 01:56:08  strk
 *
 * Code base padded with 'const' keywords ;)
 *
 * Revision 1.13  2003/10/09 10:10:05  strk
 * Throw an exception if scale is 0. Added Log entry.
 *
 **********************************************************************/


#include <geos/geom.h>
#include <geos/util.h>
#include <stdio.h>

namespace geos {

const double maximumPreciseValue=9007199254740992.0;

/**
* Implementation of rint() for Visual C++
*/
double rint_vc(double val) {
	double n;
	double f=fabs(modf(val,&n));
	if (val>=0) {
		if (f<0.5) {
			return floor(val);
		} else if (f>0.5) {
			return ceil(val);
		} else {
			return(floor(n/2)==n/2)?n:n+1.0;
		}
	} else {
		if (f<0.5) {
			return ceil(val);
		} else if (f>0.5) {<commit_msg>Fixed maximumPreciseValue scope<commit_after>/**********************************************************************
 * $Id$
 *
 * GEOS - Geometry Engine Open Source
 * http://geos.refractions.net
 *
 * Copyright (C) 2001-2002 Vivid Solutions Inc.
 *
 * This is free software; you can redistribute and/or modify it under
 * the terms of the GNU Lesser General Public Licence as published
 * by the Free Software Foundation. 
 * See the COPYING file for more information.
 *
 **********************************************************************
 * $Log$
 * Revision 1.27  2004/07/12 15:42:03  strk
 * Fixed maximumPreciseValue scope
 *
 * Revision 1.26  2004/07/05 14:23:03  strk
 * More documentation cleanups.
 *
 * Revision 1.25  2004/07/03 12:51:37  strk
 * Documentation cleanups for DoxyGen.
 *
 * Revision 1.24  2004/07/02 13:28:26  strk
 * Fixed all #include lines to reflect headers layout change.
 * Added client application build tips in README.
 *
 * Revision 1.23  2004/05/28 18:16:01  ybychkov
 * Changed rounding method to make compilable with VC++
 *
 * Revision 1.22  2004/05/21 13:39:31  strk
 * ::makePrecise make use of nearbyint() now, to be compatible with JTS
 *
 * Revision 1.21  2004/05/19 19:39:05  ybychkov
 * Changed rounding method to make compilable with VC++
 *
 * Revision 1.20  2004/05/17 10:45:58  strk
 * Fixed bogus FIXED coordinate rounding
 *
 * Revision 1.19  2004/04/16 07:42:06  strk
 * PrecisionModel::Type made an enum instead of a Type.
 *
 * Revision 1.18  2004/04/14 09:38:10  strk
 * PrecisionModel(double newScale) missed to set the scale
 *
 * Revision 1.17  2004/03/31 07:50:37  ybychkov
 * "geom" partially upgraded to JTS 1.4
 *
 * Revision 1.16  2003/11/12 17:15:05  strk
 * made sure PrecisionModel scale is never 0
 *
 * Revision 1.15  2003/11/07 01:23:42  pramsey
 * Add standard CVS headers licence notices and copyrights to all cpp and h
 * files.
 *
 * Revision 1.14  2003/10/11 01:56:08  strk
 *
 * Code base padded with 'const' keywords ;)
 *
 * Revision 1.13  2003/10/09 10:10:05  strk
 * Throw an exception if scale is 0. Added Log entry.
 *
 **********************************************************************/


#include <geos/geom.h>
#include <geos/util.h>
#include <stdio.h>

namespace geos {

const double PrecisionModel::maximumPreciseValue=9007199254740992.0;

/**
* Implementation of rint() for Visual C++
*/
double rint_vc(double val) {
	double n;
	double f=fabs(modf(val,&n));
	if (val>=0) {
		if (f<0.5) {
			return floor(val);
		} else if (f>0.5) {
			return ceil(val);
		} else {
			return(floor(n/2)==n/2)?n:n+1.0;
		}
	} else {
		if (f<0.5) {
			return ceil(val);
		} else if (f>0.5) {
{'fraction_non_alphanumeric': 0.18742813338443848, 'fraction_numerical': 0.11057876581065543, 'mean_word_length': 3.610424028268551, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '338177', 'n_tokens_mistral': 2236, 'n_tokens_neox': 1782, 'n_words': 564}