mirror of
				https://github.com/Z3Prover/z3
				synced 2025-11-03 21:09:11 +00:00 
			
		
		
		
	Fix rounding bug in mpf_manager. Fixes #2970.
This commit is contained in:
		
							parent
							
								
									ccdae7af24
								
							
						
					
					
						commit
						d3ae40130a
					
				
					 1 changed files with 2 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -351,10 +351,7 @@ void mpf_manager::set(mpf & o, unsigned ebits, unsigned sbits, mpf_rounding_mode
 | 
			
		|||
 | 
			
		||||
        signed ds = sbits - x.sbits + 3;  // plus rounding bits
 | 
			
		||||
        if (ds > 0)
 | 
			
		||||
        {
 | 
			
		||||
            m_mpz_manager.mul2k(o.significand, ds);
 | 
			
		||||
            round(rm, o);
 | 
			
		||||
        }
 | 
			
		||||
        else if (ds < 0)
 | 
			
		||||
        {
 | 
			
		||||
            bool sticky = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -366,8 +363,9 @@ void mpf_manager::set(mpf & o, unsigned ebits, unsigned sbits, mpf_rounding_mode
 | 
			
		|||
            }
 | 
			
		||||
            if (sticky && m_mpz_manager.is_even(o.significand))
 | 
			
		||||
                m_mpz_manager.inc(o.significand);
 | 
			
		||||
            round(rm, o);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        round(rm, o);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue