Blame snprintf/floatio.h

Packit c04fcb
/*	$OpenBSD: floatio.h,v 1.4 2008/09/07 20:36:08 martynas Exp $	*/
Packit c04fcb
Packit c04fcb
/*-
Packit c04fcb
 * Copyright (c) 1990, 1993
Packit c04fcb
 *	The Regents of the University of California.  All rights reserved.
Packit c04fcb
 *
Packit c04fcb
 * This code is derived from software contributed to Berkeley by
Packit c04fcb
 * Chris Torek.
Packit c04fcb
 *
Packit c04fcb
 * Redistribution and use in source and binary forms, with or without
Packit c04fcb
 * modification, are permitted provided that the following conditions
Packit c04fcb
 * are met:
Packit c04fcb
 * 1. Redistributions of source code must retain the above copyright
Packit c04fcb
 *    notice, this list of conditions and the following disclaimer.
Packit c04fcb
 * 2. Redistributions in binary form must reproduce the above copyright
Packit c04fcb
 *    notice, this list of conditions and the following disclaimer in the
Packit c04fcb
 *    documentation and/or other materials provided with the distribution.
Packit c04fcb
 * 3. Neither the name of the University nor the names of its contributors
Packit c04fcb
 *    may be used to endorse or promote products derived from this software
Packit c04fcb
 *    without specific prior written permission.
Packit c04fcb
 *
Packit c04fcb
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
Packit c04fcb
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit c04fcb
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit c04fcb
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
Packit c04fcb
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit c04fcb
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
Packit c04fcb
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
Packit c04fcb
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
Packit c04fcb
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
Packit c04fcb
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
Packit c04fcb
 * SUCH DAMAGE.
Packit c04fcb
 */
Packit c04fcb
Packit c04fcb
/*
Packit c04fcb
 * Floating point scanf/printf (input/output) definitions.
Packit c04fcb
 */
Packit c04fcb
Packit c04fcb
/* 11-bit exponent (VAX G floating point) is 308 decimal digits */
Packit c04fcb
#define	MAXEXP		308
Packit c04fcb
/* 128 bit fraction takes up 39 decimal digits; max reasonable precision */
Packit c04fcb
#define	MAXFRACT	39
Packit c04fcb
Packit c04fcb
/*
Packit c04fcb
 * MAXEXPDIG is the maximum number of decimal digits needed to store a
Packit c04fcb
 * floating point exponent in the largest supported format.  It should
Packit c04fcb
 * be ceil(log10(LDBL_MAX_10_EXP)) or, if hexadecimal floating point
Packit c04fcb
 * conversions are supported, ceil(log10(LDBL_MAX_EXP)).  But since it
Packit c04fcb
 * is presently never greater than 5 in practice, we fudge it.
Packit c04fcb
 */
Packit c04fcb
#define	MAXEXPDIG	6
Packit c04fcb
#if LDBL_MAX_EXP > 999999
Packit c04fcb
#error "floating point buffers too small"
Packit c04fcb
#endif
Packit c04fcb
Packit c04fcb
char *__hdtoa(double, const char *, int, int *, int *, char **);
Packit c04fcb
char *__hldtoa(long double, const char *, int, int *, int *, char **);
Packit c04fcb
char *__ldtoa(long double *, int, int, int *, int *, char **);