From 9f633256dea9a141bc5a4d96b2b9c47e3ecb4858 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 13 Nov 2015 20:36:46 -0800 Subject: New global control over float print precision. * configure (have_dbl_decimal_dig): New variable. New configure test to test for DBL_DECIMAL_DIG or __DBL_DECIMAL_DIG__, resulting in FLO_MAX_DIG macro being deposited in config.h. * arith.c (arith_init): Register flo-max-dig variable. * stream.c (print_flo_precision_s): New symbol variable. (formatv): Obtain default precision from *print-flo-precision* special variable, rather than hard coded DBL_DIG. (stream_init): Initialize print_flo_precision_s variable, and register *print-flo-precision* special. * txr.1: Document flo-max-dig, *print-flo-precision*, and change of behavior in format. --- configure | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'configure') diff --git a/configure b/configure index 8ee9c4e0..528f77ad 100755 --- a/configure +++ b/configure @@ -112,6 +112,7 @@ lit_align= extra_debugging= debug_support=y gen_gc=y +have_dbl_decimal_dig= have_unistd= have_sys_time= have_syslog= @@ -1264,6 +1265,37 @@ fi printf '"%s"\n' "$inline" printf "#define INLINE $inline\n" >> $config_h +# +# DBL_DECIMAL_DIG +# + +printf "Checking for DBL_DECIMAL_DIG ... " + +for try_sym in DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__ ; do + cat > conftest.c < + +#ifndef $try_sym +#error $try_sym not defined +#else +int main(void) +{ + return 0; +} +#endif +! + if conftest ; then + printf "yes (%s)\n" $try_sym + printf "#define FLO_MAX_DIG $try_sym\n" >> $config_h + have_dbl_decimal_dig=y + fi +done + +if ! [ $have_dbl_decimal_dig ] ; then + printf "no\n" + printf "#define FLO_MAX_DIG (DBL_DIG + 2)\n" >> $config_h +fi + # # Valgrind # -- cgit v1.2.3