<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/61036>61036</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Cleanup libc math function implementations around their use of errno
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            code-cleanup,
            libc
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            lntue
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          sivachandra
      </td>
    </tr>
</table>

<pre>
    This cleanup is to aid with https://discourse.llvm.org/t/rfc-improving-the-hermeticity-of-tests-with-respect-to-errno/68684. Couple of things to be done:

1. Make the helper functions more idiomatic wrt setting errno. We do not want to set errno in helper functions. The helper functions should instead return cpp::optional or __llvm_libc::ErrorOr as appropriate.
2. If a standard spec requires that a libc function set errno on error, then it should be just before returning from that function.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsk8GOozgQhp8GLiUQGEKSA4fe9Ebaw2ovLe2xZewiVI-xmXK5W_32Iyfp7hnNXBIko7_--visY6SLRxyL3V-FUs5LwkKpYvdY6iRL4DHSqzaL9pZ1OQX7Pj4tFME41D5tQBEkgCYLbyQLLCJbLLqHQp0LdbYUTUgcsXbuda0DXwp1lkKdeTYVrRuHV_KXShasFuQVhQzJexXmSjBKrHJkxRg3NFJJqJDZh0Kdh8Nw6Gs4hbQ5hDCDLOQv1yYTgg0ec4XmsWjuv20N_-pvCLIgLOg2ZJiTN0LBR1gDI5ClsGohA28sEFGE_AWuA2v4P4eCDwJv2kseE1Fuh0D-t8Qanv40Jy4hOQvko6C2wCiJPZhty2W7h7Dl17SDwPD8nIE9O5rM7fBv5sD_MegIets4bExasL5tp2r4ZwYNUbS3mi1kYMD4PRFjBFm0gIYc9tnmpwWCzw-BC3XKfDyQfFSdEF5SFJhwzoxujTOXmcN6y_0IrEs7dvbYHXWJYzvs97uu6_pjuYxW2Z1VHfZa9TMeBo3aYt-iPh7QTM1Q0qga1TVK7VWrjs2x7pVtG6OHZmrNsG_7om9w1eQ-LSopxoTj0DbdUDo9oYt3f02wWN3dzBqrU5Y6Y7w5zWPOqKZ0iUXfOIoSv1KFxOF4upt95bVqWb6g0bo5XNGLvn1RzSF5m6kRQ4pXFa9Qy8Ru_PUuXEiWNNUmrIU655H3v2rj8IIm34rrVjH7nRf7EQAA___AIDv4">