RemoveSubnormals Namespace Reference

Functions

def main ()
 

Function Documentation

◆ main()

def RemoveSubnormals.main ( )
17 def main():
18  if len(sys.argv) < 2:
19  raise Exception("You need to provide a filename as command line argument")
20  # get name
21  file_name = sys.argv[1]
22  print("Input file: %s" % file_name)
23  # open
24  input = open(file_name, 'r')
25  lines = input.readlines()
26  input.close()
27  words = [line.split() for line in lines]
28  for i, wordList in enumerate(words):
29  for j, word in enumerate(wordList):
30  try:
31  if 0 < abs(float(word)) < 1.2e-38:
32  print("subnormal %r %s" % (float(word), word))
33  words[i][j] = "0"
34  except:
35  pass
36 
37  # open
38  print("Input file: %s.out" % file_name)
39  output = open(file_name+'.out', 'w')
40  lines = [" ".join(word) for word in words]
41  text = "\n".join(lines)
42  output.write(text)
43 
AnnoyingScalar abs(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:135
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet print(const Packet &a)
Definition: GenericPacketMath.h:1166
def main()
Definition: RemoveSubnormals.py:17

References abs(), and Eigen::internal.print().