diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/scripts/frozen_derivation_test.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/scripts/frozen_derivation_test.py
index f3ae6d70299922a80bd8d25372ec5b5ec433850d..b0510b033febae27f15c1f3a4a0163dcf6f1647a 100755
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/scripts/frozen_derivation_test.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/scripts/frozen_derivation_test.py
@@ -110,7 +110,8 @@ def compare_files(cleanHeadDir,uniqId,pwd,isPatchedOnly):
 
     comparison_command = ( 'acmd.py diff-root ' + cleanDir + '/DAOD_PHYSVAL.pool.root '
                            'patched_derivation_test/DAOD_PHYSVAL.pool.root ' 
-                           '--error-mode resilient ' 
+                           '--error-mode resilient '
+                           '--nan-equal '
                            '--entries 20 > patched_derivation_test/diff-root.DAOD.log 2>&1' )
     output,error = subprocess.Popen(['/bin/bash', '-c', comparison_command], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
 
diff --git a/Tools/PyUtils/python/scripts/diff_root_files.py b/Tools/PyUtils/python/scripts/diff_root_files.py
index 8566e84e53298d7843c770dc58daed607b795c8a..e079ee6fc5e9a6254bb0cc33a9be0b405f623bb7 100644
--- a/Tools/PyUtils/python/scripts/diff_root_files.py
+++ b/Tools/PyUtils/python/scripts/diff_root_files.py
@@ -91,6 +91,11 @@ default='%(default)s'.
 allowed: %(choices)s
 """
                   )
+@acmdlib.argument('--nan-equal',
+                  action='store_true',
+                  default=False,
+                  help="""Compare nan as equal to nan""")
+
 def main(args):
     """check that 2 ROOT files have same content (containers and sizes)
     """
@@ -293,7 +298,7 @@ def main(args):
                 tree_name, jentry, name, inew = d_new
 
             # for regression testing we should have NAN == NAN
-            if isnan(iold) and isnan(inew):
+            if isnan(iold) and isnan(inew) and args.nan_equal:
                 n_good += 1
                 continue