mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-30 21:42:59 +00:00 
			
		
		
		
	precision in binsearch
This commit is contained in:
		
							
								
								
									
										4
									
								
								hyper.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								hyper.h
									
									
									
									
									
								
							| @@ -904,8 +904,8 @@ template <class T> void texture_order(const T& f) { | |||||||
|  |  | ||||||
| /** find the smallest value of x in range [dmin..dmax] such that f(x) returns true */ | /** find the smallest value of x in range [dmin..dmax] such that f(x) returns true */ | ||||||
|  |  | ||||||
| template<class T> ld binsearch(ld dmin, ld dmax, const T& f) { | template<class T> ld binsearch(ld dmin, ld dmax, const T& f, int iterations = 200) { | ||||||
|   for(int i=0; i<200; i++) { |   for(int i=0; i<iterations; i++) { | ||||||
|     ld d = (dmin + dmax) / 2; |     ld d = (dmin + dmax) / 2; | ||||||
|     if(dmin == d || dmax == d) break; |     if(dmin == d || dmax == d) break; | ||||||
|     if(f(d)) dmax = d; |     if(f(d)) dmax = d; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue