mirror of
				https://gitea.invidious.io/iv-org/shard-ameba.git
				synced 2024-08-15 00:53:29 +00:00 
			
		
		
		
	Do not report float numbers as large if fraction has less than 3 digits
This commit is contained in:
		
							parent
							
								
									7a4fcec5ce
								
							
						
					
					
						commit
						1cea21b147
					
				
					 2 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
					@ -69,6 +69,10 @@ module Ameba
 | 
				
			||||||
        11_234e10_f32
 | 
					        11_234e10_f32
 | 
				
			||||||
        +1.123
 | 
					        +1.123
 | 
				
			||||||
        -0.000_5
 | 
					        -0.000_5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        1200.0
 | 
				
			||||||
 | 
					        1200.01
 | 
				
			||||||
 | 
					        1200.012
 | 
				
			||||||
      )
 | 
					      )
 | 
				
			||||||
      subject.catch(s).should be_valid
 | 
					      subject.catch(s).should be_valid
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,7 +52,7 @@ module Ameba::Rule
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private def allowed?(_sign, value, fraction, _suffix)
 | 
					    private def allowed?(_sign, value, fraction, _suffix)
 | 
				
			||||||
      return true unless fraction.nil?
 | 
					      return true if !fraction.nil? && fraction.size > 3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      digits = value.chars.select &.to_s.=~ /[0-9]/
 | 
					      digits = value.chars.select &.to_s.=~ /[0-9]/
 | 
				
			||||||
      digits.size >= int_min_digits
 | 
					      digits.size >= int_min_digits
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue