prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  `cupy.nextafter` is wrong on a=0
  `test_nextafter_combination` is failing.
  
  `{'dtype_b': <type 'numpy.float32'>, 'dtype_a': <type 'numpy.bool_'>}`
  ```
  x          = array([[1.1754944e-38, 1.0000001e+00, 1.1754944e-38],
         [1.0000001e+00, 1.1754944e-38, 1.0000000e+00]], dtype=float32)
  y          = array([[1.4012985e-45, 1.0000001e+00, 1.4012985e-45],
         [1.0000001e+00, 1.4012985e-45, 1.0000000e+00]], dtype=float32)
  ```
  
  </issue>
  <code>
  [start of cupy/math/floating.py]
  1 from cupy import core
  2 from cupy.math import ufunc
  3 
  4 
  5 signbit = core.create_ufunc(
  6     'cupy_signbit',
  7     ('e->?', 'f->?', 'd->?'),
  8     'out0 = signbit(in0)',
  9     doc='''Tests elementwise if the sign bit is set (i.e. less than zero).
  10 
  11     .. seealso:: :data:`numpy.signbit`
  12 
  13     ''')
  14 
  15 
  16 copysign = ufunc.create_math_ufunc(
  17     'copysign', 2, 'cupy_copysign',
  18     '''Returns the first argument with the sign bit of the second elementwise.
  19 
  20     .. seealso:: :data:`numpy.copysign`
  21 
  22     ''')
  23 
  24 
  25 ldexp = core.create_ufunc(
  26     'cupy_ldexp',
  27     ('ei->e', 'fi->f', 'el->e', 'fl->f', 'di->d', 'dq->d'),
  28     'out0 = ldexp(in0, in1)',
  29     doc='''Computes ``x1 * 2 ** x2`` elementwise.
  30 
  31     .. seealso:: :data:`numpy.ldexp`
  32 
  33     ''')
  34 
  35 
  36 frexp = core.create_ufunc(
  37     'cupy_frexp',
  38     ('e->ei', 'f->fi', 'd->di'),
  39     'int nptr; out0 = frexp(in0, &nptr); out1 = nptr',
  40     doc='''Decomposes each element to mantissa and two's exponent.
  41 
  42     This ufunc outputs two arrays of the input dtype and the ``int`` dtype.
  43 
  44     .. seealso:: :data:`numpy.frexp`
  45 
  46     ''')
  47 
  48 
  49 nextafter = ufunc.create_math_ufunc(
  50     'nextafter', 2, 'cupy_nextafter',
  51     '''Computes the nearest neighbor float values towards the second argument.
  52 
  53     .. seealso:: :data:`numpy.nextafter`
  54 
  55     ''')
  56
  [end of cupy/math/floating.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/cupy/math/floating.py b/cupy/math/floating.py
  --- a/cupy/math/floating.py
  +++ b/cupy/math/floating.py
  @@ -50,6 +50,11 @@
       'nextafter', 2, 'cupy_nextafter',
       '''Computes the nearest neighbor float values towards the second argument.
   
  +    .. note::
  +        For values that are close to zero (or denormal numbers),
  +        results of :func:`cupy.nextafter` may be different from those of
  +        :func:`numpy.nextafter`, because CuPy sets ``-ftz=true``.
  +
       .. seealso:: :data:`numpy.nextafter`
   
       ''')
  
verification_info: {"golden_diff": "diff --git a/cupy/math/floating.py b/cupy/math/floating.py\n--- a/cupy/math/floating.py\n+++ b/cupy/math/floating.py\n@@ -50,6 +50,11 @@\n     'nextafter', 2, 'cupy_nextafter',\n     '''Computes the nearest neighbor float values towards the second argument.\n \n+    .. note::\n+        For values that are close to zero (or denormal numbers),\n+        results of :func:`cupy.nextafter` may be different from those of\n+        :func:`numpy.nextafter`, because CuPy sets ``-ftz=true``.\n+\n     .. seealso:: :data:`numpy.nextafter`\n \n     ''')\n", "issue": "`cupy.nextafter` is wrong on a=0\n`test_nextafter_combination` is failing.\r\n\r\n`{'dtype_b': <type 'numpy.float32'>, 'dtype_a': <type 'numpy.bool_'>}`\r\n```\r\nx          = array([[1.1754944e-38, 1.0000001e+00, 1.1754944e-38],\r\n       [1.0000001e+00, 1.1754944e-38, 1.0000000e+00]], dtype=float32)\r\ny          = array([[1.4012985e-45, 1.0000001e+00, 1.4012985e-45],\r\n       [1.0000001e+00, 1.4012985e-45, 1.0000000e+00]], dtype=float32)\r\n```\n", "before_files": [{"content": "from cupy import core\nfrom cupy.math import ufunc\n\n\nsignbit = core.create_ufunc(\n    'cupy_signbit',\n    ('e->?', 'f->?', 'd->?'),\n    'out0 = signbit(in0)',\n    doc='''Tests elementwise if the sign bit is set (i.e. less than zero).\n\n    .. seealso:: :data:`numpy.signbit`\n\n    ''')\n\n\ncopysign = ufunc.create_math_ufunc(\n    'copysign', 2, 'cupy_copysign',\n    '''Returns the first argument with the sign bit of the second elementwise.\n\n    .. seealso:: :data:`numpy.copysign`\n\n    ''')\n\n\nldexp = core.create_ufunc(\n    'cupy_ldexp',\n    ('ei->e', 'fi->f', 'el->e', 'fl->f', 'di->d', 'dq->d'),\n    'out0 = ldexp(in0, in1)',\n    doc='''Computes ``x1 * 2 ** x2`` elementwise.\n\n    .. seealso:: :data:`numpy.ldexp`\n\n    ''')\n\n\nfrexp = core.create_ufunc(\n    'cupy_frexp',\n    ('e->ei', 'f->fi', 'd->di'),\n    'int nptr; out0 = frexp(in0, &nptr); out1 = nptr',\n    doc='''Decomposes each element to mantissa and two's exponent.\n\n    This ufunc outputs two arrays of the input dtype and the ``int`` dtype.\n\n    .. seealso:: :data:`numpy.frexp`\n\n    ''')\n\n\nnextafter = ufunc.create_math_ufunc(\n    'nextafter', 2, 'cupy_nextafter',\n    '''Computes the nearest neighbor float values towards the second argument.\n\n    .. seealso:: :data:`numpy.nextafter`\n\n    ''')\n", "path": "cupy/math/floating.py"}]}