Post Reply 
(PC-12xx~14xx) qthsh Tanh-Sinh quadrature
04-06-2021, 03:09 PM
Post: #26
RE: (PC-12xx~14xx) qthsh Tanh-Sinh quadrature
(04-06-2021 12:49 PM)Albert Chan Wrote:  We should also test for these, like this patch for double_exponential.py

Code:
      try: y = f(bpa2 + bma2*r)
      except ArithmeticError: y = inf
      p = 0.0 if y-y else y*w

      try: y = f(bpa2 + bma2/r) if expsinh else f(bpa2 - bma2*r)
      except ArithmeticError: y = inf
      if y-y == 0: p += y/w if expsinh else y*w

      p *= ch
      wsl += p
      tnfe += 2

Sorry, cannot see the difference between such code and the original one replacing Exception by ArithmeticError:
Code:
      try:
        fpl = f(bpa2 + bma2*r)
      except ArithmeticError:
        fpl = 0;
      p = fpl*w
      try:
        fmi = f(bpa2 + bma2/r) if expsinh else f(bpa2 - bma2*r)
      except ArithmeticError:
        fmi = 0
      tnfe += 2
      p += fmi/w if expsinh else fmi*w
      p *= ch
      wsl += p
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (PC-12xx~14xx) qthsh Tanh-Sinh quadrature - emece67 - 04-06-2021 03:09 PM



User(s) browsing this thread: 1 Guest(s)