This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[patch,complex] Replace hard-coded constants
- From: Ralf Corsepius <ralf dot corsepius at rtems dot org>
- To: "newlib at sourceware dot org" <newlib at sourceware dot org>
- Date: Fri, 26 Nov 2010 09:08:19 +0100
- Subject: [patch,complex] Replace hard-coded constants
Hi,
The functions in ctan.c, ctanf.c, catan.c and catanf.c apply hard-coded
constants which are out of range (i.e. they cause compilation warnings
and likely will cause run-time failures) on some (e.g. 16bit) targets
and likely are incorrect on all targets.
The patch below tries to replace these hard-coded constants with
[FLT|DBL_MAX] from <float.h>, when these defines are available and tries
to fall back to the original constants if these are not available.
Ralf
PS.: IMO, due to the fact <float.h> and [FLT|DBL]_MAX are POSIX and thus
should be available in any current compiler, it's likely safe to
completely remove the hard-coded constants and to directly use
[FLT|DBL]_MAX.
Attachment:
newlib-complex-ctan.diff
Description: Text document