<s> '''<STR_LIT>''' <EOL> import numpy as np <EOL> def isEvenlyDivisibleFloat ( a , b , margin = <NUM_LIT> ) : <EOL> '''<STR_LIT>''' <EOL> cexact = np . asarray ( a ) / float ( b ) <EOL> cround = np . round ( cexact ) <EOL> return abs ( cexact - cround ) < margin <EOL> def closeAtMSigFigs ( A , B , M = <NUM_LIT:10> , tol = <NUM_LIT:5> ) : <EOL> '''<STR_LIT>''' <EOL> A = float ( A ) <EOL> B = float ( B ) <EOL> if abs ( A ) < abs ( B ) : <EOL> tmp = A <EOL> A = B <EOL> B = tmp <EOL> assert abs ( A ) >= abs ( B ) <EOL> P10 = int ( np . floor ( np . log10 ( abs ( A ) ) ) ) <EOL> diff = abs ( A - B ) <EOL> if P10 >= <NUM_LIT:0> : <EOL> THR = tol * <NUM_LIT> ** ( P10 - M ) <EOL> THR = ( <NUM_LIT:1> + <NUM_LIT> ) * THR <EOL> return np . sign ( A ) == np . sign ( B ) and diff <= THR <EOL> else : <EOL> THR = tol * <NUM_LIT> ** ( - M ) <EOL> THR = ( <NUM_LIT:1> + <NUM_LIT> ) * THR <EOL> return diff <= THR </s>
