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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [newlib-1.18.0/] [newlib/] [libm/] [common/] [s_fdim.c] - Diff between revs 816 and 829

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

Rev 816 Rev 829
/* Copyright (C) 2002 by  Red Hat, Incorporated. All rights reserved.
/* Copyright (C) 2002 by  Red Hat, Incorporated. All rights reserved.
 *
 *
 * Permission to use, copy, modify, and distribute this software
 * Permission to use, copy, modify, and distribute this software
 * is freely granted, provided that this notice is preserved.
 * is freely granted, provided that this notice is preserved.
 */
 */
/*
/*
FUNCTION
FUNCTION
<<fdim>>, <<fdimf>>--positive difference
<<fdim>>, <<fdimf>>--positive difference
INDEX
INDEX
        fdim
        fdim
INDEX
INDEX
        fdimf
        fdimf
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
        #include <math.h>
        #include <math.h>
        double fdim(double <[x]>, double <[y]>);
        double fdim(double <[x]>, double <[y]>);
        float fdimf(float <[x]>, float <[y]>);
        float fdimf(float <[x]>, float <[y]>);
 
 
DESCRIPTION
DESCRIPTION
The <<fdim>> functions determine the positive difference between their
The <<fdim>> functions determine the positive difference between their
arguments, returning:
arguments, returning:
.       <[x]> - <[y]>   if <[x]> > <[y]>, or
.       <[x]> - <[y]>   if <[x]> > <[y]>, or
        @ifnottex
        @ifnottex
.       +0      if <[x]> <= <[y]>, or
.       +0      if <[x]> <= <[y]>, or
        @end ifnottex
        @end ifnottex
        @tex
        @tex
.       +0      if <[x]> $\leq$ <[y]>, or
.       +0      if <[x]> $\leq$ <[y]>, or
        @end tex
        @end tex
.       NAN     if either argument is NAN.
.       NAN     if either argument is NAN.
A range error may occur.
A range error may occur.
 
 
RETURNS
RETURNS
The <<fdim>> functions return the positive difference value.
The <<fdim>> functions return the positive difference value.
 
 
PORTABILITY
PORTABILITY
ANSI C, POSIX.
ANSI C, POSIX.
 
 
*/
*/
 
 
#include "fdlibm.h"
#include "fdlibm.h"
 
 
#ifndef _DOUBLE_IS_32BITS
#ifndef _DOUBLE_IS_32BITS
 
 
#ifdef __STDC__
#ifdef __STDC__
        double fdim(double x, double y)
        double fdim(double x, double y)
#else
#else
        double fdim(x,y)
        double fdim(x,y)
        double x;
        double x;
        double y;
        double y;
#endif
#endif
{
{
  int c = __fpclassifyd(x);
  int c = __fpclassifyd(x);
  if (c == FP_NAN)  return(x);
  if (c == FP_NAN)  return(x);
  if (__fpclassifyd(y) == FP_NAN)  return(y);
  if (__fpclassifyd(y) == FP_NAN)  return(y);
  if (c == FP_INFINITE)
  if (c == FP_INFINITE)
    return HUGE_VAL;
    return HUGE_VAL;
 
 
  return x > y ? x - y : 0.0;
  return x > y ? x - y : 0.0;
}
}
 
 
#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.