OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc1/] [newlib/] [libm/] [math/] [s_ldexp.c] - Diff between revs 207 and 345

Only display areas with differences | Details | Blame | View Log

Rev 207 Rev 345
 
 
/* @(#)s_ldexp.c 5.1 93/09/24 */
/* @(#)s_ldexp.c 5.1 93/09/24 */
/*
/*
 * ====================================================
 * ====================================================
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
 *
 *
 * Developed at SunPro, a Sun Microsystems, Inc. business.
 * Developed at SunPro, a Sun Microsystems, Inc. business.
 * Permission to use, copy, modify, and distribute this
 * Permission to use, copy, modify, and distribute this
 * software is freely granted, provided that this notice
 * software is freely granted, provided that this notice
 * is preserved.
 * is preserved.
 * ====================================================
 * ====================================================
 */
 */
 
 
/*
/*
FUNCTION
FUNCTION
       <<ldexp>>, <<ldexpf>>---load exponent
       <<ldexp>>, <<ldexpf>>---load exponent
 
 
INDEX
INDEX
        ldexp
        ldexp
INDEX
INDEX
        ldexpf
        ldexpf
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
       #include <math.h>
       #include <math.h>
       double ldexp(double <[val]>, int <[exp]>);
       double ldexp(double <[val]>, int <[exp]>);
       float ldexpf(float <[val]>, int <[exp]>);
       float ldexpf(float <[val]>, int <[exp]>);
 
 
TRAD_SYNOPSIS
TRAD_SYNOPSIS
       #include <math.h>
       #include <math.h>
 
 
       double ldexp(<[val]>, <[exp]>)
       double ldexp(<[val]>, <[exp]>)
              double <[val]>;
              double <[val]>;
              int <[exp]>;
              int <[exp]>;
 
 
       float ldexpf(<[val]>, <[exp]>)
       float ldexpf(<[val]>, <[exp]>)
              float <[val]>;
              float <[val]>;
              int <[exp]>;
              int <[exp]>;
 
 
 
 
DESCRIPTION
DESCRIPTION
<<ldexp>> calculates the value
<<ldexp>> calculates the value
@ifnottex
@ifnottex
<[val]> times 2 to the power <[exp]>.
<[val]> times 2 to the power <[exp]>.
@end ifnottex
@end ifnottex
@tex
@tex
$val\times 2^{exp}$.
$val\times 2^{exp}$.
@end tex
@end tex
<<ldexpf>> is identical, save that it takes and returns <<float>>
<<ldexpf>> is identical, save that it takes and returns <<float>>
rather than <<double>> values.
rather than <<double>> values.
 
 
RETURNS
RETURNS
<<ldexp>> returns the calculated value.
<<ldexp>> returns the calculated value.
 
 
Underflow and overflow both set <<errno>> to <<ERANGE>>.
Underflow and overflow both set <<errno>> to <<ERANGE>>.
On underflow, <<ldexp>> and <<ldexpf>> return 0.0.
On underflow, <<ldexp>> and <<ldexpf>> return 0.0.
On overflow, <<ldexp>> returns plus or minus <<HUGE_VAL>>.
On overflow, <<ldexp>> returns plus or minus <<HUGE_VAL>>.
 
 
PORTABILITY
PORTABILITY
<<ldexp>> is ANSI. <<ldexpf>> is an extension.
<<ldexp>> is ANSI. <<ldexpf>> is an extension.
 
 
*/
*/
 
 
#include "fdlibm.h"
#include "fdlibm.h"
#include <errno.h>
#include <errno.h>
 
 
#ifndef _DOUBLE_IS_32BITS
#ifndef _DOUBLE_IS_32BITS
 
 
#ifdef __STDC__
#ifdef __STDC__
        double ldexp(double value, int exp)
        double ldexp(double value, int exp)
#else
#else
        double ldexp(value, exp)
        double ldexp(value, exp)
        double value; int exp;
        double value; int exp;
#endif
#endif
{
{
        if(!finite(value)||value==0.0) return value;
        if(!finite(value)||value==0.0) return value;
        value = scalbn(value,exp);
        value = scalbn(value,exp);
        if(!finite(value)||value==0.0) errno = ERANGE;
        if(!finite(value)||value==0.0) errno = ERANGE;
        return value;
        return value;
}
}
 
 
#endif /* _DOUBLE_IS_32BITS */
#endif /* _DOUBLE_IS_32BITS */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.