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/] [common/] [s_fmax.c] - Blame information for rev 345

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/* Copyright (C) 2002 by  Red Hat, Incorporated. All rights reserved.
2
 *
3
 * Permission to use, copy, modify, and distribute this software
4
 * is freely granted, provided that this notice is preserved.
5
 */
6
/*
7
FUNCTION
8
<<fmax>>, <<fmaxf>>--maximum
9
INDEX
10
        fmax
11
INDEX
12
        fmaxf
13
 
14
ANSI_SYNOPSIS
15
        #include <math.h>
16
        double fmax(double <[x]>, double <[y]>);
17
        float fmaxf(float <[x]>, float <[y]>);
18
 
19
DESCRIPTION
20
The <<fmax>> functions determine the maximum numeric value of their arguments.
21
NaN arguments are treated as missing data:  if one argument is a NaN and the
22
other numeric, then the <<fmax>> functions choose the numeric value.
23
 
24
RETURNS
25
The <<fmax>> functions return the maximum numeric value of their arguments.
26
 
27
PORTABILITY
28
ANSI C, POSIX.
29
 
30
*/
31
 
32
#include "fdlibm.h"
33
 
34
#ifndef _DOUBLE_IS_32BITS
35
 
36
#ifdef __STDC__
37
        double fmax(double x, double y)
38
#else
39
        double fmax(x,y)
40
        double x;
41
        double y;
42
#endif
43
{
44
  if (__fpclassifyd(x) == FP_NAN)
45
    return y;
46
  if (__fpclassifyd(y) == FP_NAN)
47
    return x;
48
 
49
  return x > y ? x : y;
50
}
51
 
52
#endif /* _DOUBLE_IS_32BITS */

powered by: WebSVN 2.1.0

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