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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [sh4a-fprun.c] - Blame information for rev 149

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

Line No. Rev Author Line
1 149 jeremybenn
/* Verify that fsca and fssra yield reasonable results.  */
2
/* { dg-do run { target "sh*-*-*" } } */
3
/* { dg-options "-O -ffast-math" } */
4
 
5
#include <math.h>
6
#include <stdlib.h>
7
 
8
float sqrt_arg = 4.0f, sqrt_res = 2.0f;
9
float dg2rad_f;
10
double dg2rad_d;
11
 
12
void check_f (float res, float expected) {
13
  if (res >= expected - 0.001f && res <= expected + 0.001f)
14
    return;
15
 
16
  abort ();
17
}
18
 
19
void check_d (double res, double expected) {
20
  if (res >= expected - 0.001 && res <= expected + 0.001)
21
    return;
22
 
23
  abort ();
24
}
25
 
26
int main() {
27
  check_f (sqrtf(sqrt_arg), sqrt_res);
28
  dg2rad_f = dg2rad_d = atan(1) / 45;
29
  check_f (sinf(90*dg2rad_f), 1);
30
  check_f (cosf(90*dg2rad_f), 0);
31
  check_d (sin(-90*dg2rad_d), -1);
32
  check_d (cos(180*dg2rad_d), -1);
33
  check_d (sin(-45*dg2rad_d) * cosf(135*dg2rad_f), 0.5);
34
  exit (0);
35
}

powered by: WebSVN 2.1.0

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