From 3e0eb5d58a58efab062ca59764a9ed6dd2e6eaf4 Mon Sep 17 00:00:00 2001 From: ceriel Date: Tue, 19 Mar 1991 10:25:36 +0000 Subject: [PATCH] Detect too large values --- lang/pc/libpc/cvt.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lang/pc/libpc/cvt.c b/lang/pc/libpc/cvt.c index 9867a6372..e53492026 100644 --- a/lang/pc/libpc/cvt.c +++ b/lang/pc/libpc/cvt.c @@ -1,6 +1,10 @@ /* $Header$ */ #ifndef NOFLOAT +#if __STDC__ +#include +#endif + static char *cvt(); #define NDIGITS 128 @@ -55,6 +59,11 @@ cvt(value, ndigit, decpt, sign, ecvtflag) } *decpt = 0; +#if __STDC__ + if (value >= DBL_MAX) { + value = DBL_MAX; + } +#endif if (value != 0.0) { register struct powers_of_10 *pp = &p10[0];