mirror of
				https://github.com/chibicitiberiu/rainmeter-studio.git
				synced 2024-02-24 04:33:31 +00:00 
			
		
		
		
	MathParser: Use std::trunc instead of custom implementation
This commit is contained in:
		@@ -99,7 +99,6 @@ struct Function
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static double frac(double x);
 | 
			
		||||
static double trunc(double x);
 | 
			
		||||
static double rad(double deg);
 | 
			
		||||
static double sgn(double x);
 | 
			
		||||
static double neg(double x);
 | 
			
		||||
@@ -848,11 +847,6 @@ static double frac(double x)
 | 
			
		||||
	return modf(x, &y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static double trunc(double x)
 | 
			
		||||
{
 | 
			
		||||
	return (x >= 0.0) ? floor(x) : ceil(x);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static double rad(double deg)
 | 
			
		||||
{
 | 
			
		||||
	return (deg / 180.0) * M_PI;
 | 
			
		||||
 
 | 
			
		||||
@@ -61,6 +61,9 @@ public:
 | 
			
		||||
		ParseAssert(L"1 ? 2 : 1 ? 4 : 5", 4.0);
 | 
			
		||||
		ParseAssert(L"1 ? 2 : (1 ? 4 : 5)", 2.0);
 | 
			
		||||
		ParseAssert(L"0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:(0?1:5)))))))))))))))))))))))))))))", 5.0);
 | 
			
		||||
		ParseAssert(L"trunc(1.5)", 1.0);
 | 
			
		||||
		ParseAssert(L"trunc(-1.5)", -1.0);
 | 
			
		||||
		ParseAssert(L"round(1.555, 2)", 1.56);
 | 
			
		||||
 | 
			
		||||
		double value;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user