From 291053e1e2df0b2176d4596cf5555c133d3f894c Mon Sep 17 00:00:00 2001 From: mycroft Date: Sun, 29 Aug 1999 18:23:26 +0000 Subject: [PATCH] Use ieee.h. --- lib/libc/arch/mips/gen/frexp.c | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/lib/libc/arch/mips/gen/frexp.c b/lib/libc/arch/mips/gen/frexp.c index b7204885ffcd..38c403eaa326 100644 --- a/lib/libc/arch/mips/gen/frexp.c +++ b/lib/libc/arch/mips/gen/frexp.c @@ -1,8 +1,8 @@ -/* $NetBSD: frexp.c,v 1.3 1997/07/13 18:45:24 christos Exp $ */ +/* $NetBSD: frexp.c,v 1.4 1999/08/29 18:23:26 mycroft Exp $ */ /*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -36,14 +36,14 @@ #include #if defined(LIBC_SCCS) && !defined(lint) #if 0 -static char sccsid[] = "@(#)frexp.c 8.1 (Berkeley) 6/4/93"; +static char sccsid[] = "@(#)frexp.c 5.1 (Berkeley) 3/7/91"; #else -__RCSID("$NetBSD: frexp.c,v 1.3 1997/07/13 18:45:24 christos Exp $"); +__RCSID("$NetBSD: frexp.c,v 1.4 1999/08/29 18:23:26 mycroft Exp $"); #endif #endif /* LIBC_SCCS and not lint */ #include -#include +#include #include double @@ -53,28 +53,16 @@ frexp(value, eptr) { union { double v; - struct { -#if BYTE_ORDER == LITTLE_ENDIAN - u_int u_mant2 : 32; - u_int u_mant1 : 20; - u_int u_exp : 11; - u_int u_sign : 1; -#else - u_int u_sign : 1; - u_int u_exp : 11; - u_int u_mant1 : 20; - u_int u_mant2 : 32; -#endif - } s; + struct ieee_double s; } u; if (value) { u.v = value; - *eptr = u.s.u_exp - 1022; - u.s.u_exp = 1022; - return(u.v); + *eptr = u.s.dbl_exp - (DBL_EXP_BIAS - 1); + u.s.dbl_exp = DBL_EXP_BIAS - 1; + return (u.v); } else { *eptr = 0; - return((double)0); + return (0.0); } }