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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [c-c++-common/] [dfp/] [compare-eq-const.c] - Blame information for rev 700

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 686 jeremybenn
/* C99 6.5.9 Equality operators.
2
   Compare decimal float constants against each other. */
3
 
4
#include "dfp-dbg.h"
5
 
6
extern void link_error (void);
7
 
8
int
9
main ()
10
{
11
  /* Compare like-typed positive constants. */
12
  if (2.0df != 2.0df)
13
    link_error ();
14
 
15
  /* Compare decimal float constants of different types. */
16
  if (500e-2dl != 0.05e2df)
17
    link_error ();
18
 
19
  /* Binary floating point introduces errors to decimal values. */
20
  if (1.4 + 1.4 + 1.4 == 4.2)
21
    link_error ();
22
 
23
  /* But, this looks more like what one would expect. */
24
  if (1.4dd + 1.4dd + 1.4dd != 4.2dd)
25
    link_error ();
26
 
27
  FINISH
28
}

powered by: WebSVN 2.1.0

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