OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libm/] [math/] [sf_copysign.c] - Diff between revs 39 and 40

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 39 Rev 40
/* sf_copysign.c -- float version of s_copysign.c.
/* sf_copysign.c -- float version of s_copysign.c.
 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
 */
 */
 
 
/*
/*
 * ====================================================
 * ====================================================
 * 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.
 * ====================================================
 * ====================================================
 */
 */
 
 
/*
/*
 * copysignf(float x, float y)
 * copysignf(float x, float y)
 * copysignf(x,y) returns a value with the magnitude of x and
 * copysignf(x,y) returns a value with the magnitude of x and
 * with the sign bit of y.
 * with the sign bit of y.
 */
 */
 
 
#include "fdlibm.h"
#include "fdlibm.h"
 
 
#ifdef __STDC__
#ifdef __STDC__
        float copysignf(float x, float y)
        float copysignf(float x, float y)
#else
#else
        float copysignf(x,y)
        float copysignf(x,y)
        float x,y;
        float x,y;
#endif
#endif
{
{
        __uint32_t ix,iy;
        __uint32_t ix,iy;
        GET_FLOAT_WORD(ix,x);
        GET_FLOAT_WORD(ix,x);
        GET_FLOAT_WORD(iy,y);
        GET_FLOAT_WORD(iy,y);
        SET_FLOAT_WORD(x,(ix&0x7fffffff)|(iy&0x80000000));
        SET_FLOAT_WORD(x,(ix&0x7fffffff)|(iy&0x80000000));
        return x;
        return x;
}
}
 
 
#ifdef _DOUBLE_IS_32BITS
#ifdef _DOUBLE_IS_32BITS
 
 
#ifdef __STDC__
#ifdef __STDC__
        double copysign(double x, double y)
        double copysign(double x, double y)
#else
#else
        double copysign(x,y)
        double copysign(x,y)
        double x,y;
        double x,y;
#endif
#endif
{
{
        return (double) copysignf((float) x, (float) y);
        return (double) copysignf((float) x, (float) y);
}
}
 
 
#endif /* defined(_DOUBLE_IS_32BITS) */
#endif /* defined(_DOUBLE_IS_32BITS) */
 
 

powered by: WebSVN 2.1.0

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