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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [ieee/] [mzero4.c] - Blame information for rev 688

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
/* Copyright (C) 2003  Free Software Foundation.
2
   by Roger Sayle <roger@eyesopen.com>, derived from mzero3.c
3
 
4
   Constant folding of sin(-0.0), tan(-0.0) and atan(-0.0) should
5
   all return -0.0, for both double and float forms.  */
6
 
7
void abort (void);
8
typedef __SIZE_TYPE__ size_t;
9
extern int memcmp (const void *, const void *, size_t);
10
 
11
double sin (double);
12
double tan (double);
13
double atan (double);
14
 
15
float sinf (float);
16
float tanf (float);
17
float atanf (float);
18
 
19
void expectd (double, double);
20
void expectf (float, float);
21
 
22
void
23
expectd (double value, double expected)
24
{
25
  if (value != expected
26
      || memcmp ((void *)&value, (void *) &expected, sizeof (double)) != 0)
27
    abort ();
28
}
29
 
30
void
31
expectf (float value, float expected)
32
{
33
  if (value != expected
34
      || memcmp ((void *)&value, (void *) &expected, sizeof (float)) != 0)
35
    abort ();
36
}
37
 
38
int main ()
39
{
40
  expectd (sin (0.0), 0.0);
41
  expectd (tan (0.0), 0.0);
42
  expectd (atan (0.0), 0.0);
43
 
44
  expectd (sin (-0.0), -0.0);
45
  expectd (tan (-0.0), -0.0);
46
  expectd (atan (-0.0), -0.0);
47
 
48
  expectf (sinf (0.0f), 0.0f);
49
  expectf (tanf (0.0f), 0.0f);
50
  expectf (atanf (0.0f), 0.0f);
51
 
52
  expectf (sinf (-0.0f), -0.0f);
53
  expectf (tanf (-0.0f), -0.0f);
54
  expectf (atanf (-0.0f), -0.0f);
55
 
56
  return 0;
57
}
58
 

powered by: WebSVN 2.1.0

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