[0/2] libm: Changes to errno and math_errhandling

Message ID 20200803175504.844738-1-keithp@keithp.com
Headers show
Series
  • libm: Changes to errno and math_errhandling
Related show

Message

Torbjorn SVENSSON via Newlib Aug. 3, 2020, 5:55 p.m.
Here are a couple of related patches that adjust errno and exception
configuration stuff.

The first patch makes libm/common use the same configuration value as
libm/math to decide whether to set errno when exceptions occur. With
that, users of libm/math get consistent errno reporting across the
whole math library when using the normal API. When errno is enabled,
calls to some __ieee754 symbols may end up setting errno still.

The second patch sets the math_errhandling value based on library and
hardware configuration so that applications can tell whether
exceptions and errno are supported. This requires configuration on a
per-target basis in machine/ieeefp.h; I've added configuration for
arm, aarch64, x86, x86_64 and RISC-V. I think this could be automated.

Reporting on whether exceptions are supported suffers from
inconsistent exception support for hardware that uses a mixture of
hardware and software for floating point operations. I haven't found
any standards-conformant mechanism to use though.

Comments

Torbjorn SVENSSON via Newlib Aug. 4, 2020, 5:31 p.m. | #1
On Aug  3 10:55, Keith Packard via Newlib wrote:
> Here are a couple of related patches that adjust errno and exception

> configuration stuff.

> 

> The first patch makes libm/common use the same configuration value as

> libm/math to decide whether to set errno when exceptions occur. With

> that, users of libm/math get consistent errno reporting across the

> whole math library when using the normal API. When errno is enabled,

> calls to some __ieee754 symbols may end up setting errno still.

> 

> The second patch sets the math_errhandling value based on library and

> hardware configuration so that applications can tell whether

> exceptions and errno are supported. This requires configuration on a

> per-target basis in machine/ieeefp.h; I've added configuration for

> arm, aarch64, x86, x86_64 and RISC-V. I think this could be automated.

> 

> Reporting on whether exceptions are supported suffers from

> inconsistent exception support for hardware that uses a mixture of

> hardware and software for floating point operations. I haven't found

> any standards-conformant mechanism to use though.

> 


Pushed with v2 of patch 2.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat