PredicatesInit.cpp
Go to the documentation of this file.
1 // ========================================================================================
2 // ApproxMVBB
3 // Copyright (C) 2014 by Gabriel Nützi <nuetzig (at) imes (d0t) mavt (d0t) ethz (døt) ch>
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 // ========================================================================================
9 
10 
11 #include <stdio.h>
12 
13 /* FPU control. We MUST have only double precision (not extended precision) */
15 
16 
17 int main (int , char * [])
18 {
20 
21  double half = 0.5;
22  double check = 1.0, lastcheck;
23  int every_other = 1;
24  /* epsilon = 2^(-p). Used to estimate roundoff errors. */
25  double epsilon = 1.0;
26  /* splitter = 2^ceiling(p / 2) + 1. Used to split floats in half. */
27  double splitter = 1.0;
28  /* A set of coefficients used to calculate maximum roundoff errors. */
29  double resulterrbound;
34 
36 
37  epsilon = 1.0;
38  splitter = 1.0;
39  /* Repeatedly divide `epsilon' by two until it is too small to add to */
40  /* one without causing roundoff. (Also check if the sum is equal to */
41  /* the previous sum, for machines that round up instead of using exact */
42  /* rounding. Not that this library will work on such machines anyway). */
43  do {
44  lastcheck = check;
45  epsilon *= half;
46  if (every_other) {
47  splitter *= 2.0;
48  }
49  every_other = !every_other;
50  check = 1.0 + epsilon;
51  } while ((check != 1.0) && (check != lastcheck));
52  splitter += 1.0;
53  /* Error bounds for orientation and incircle tests. */
54  resulterrbound = (3.0 + 8.0 * epsilon) * epsilon;
55  ccwerrboundA = (3.0 + 16.0 * epsilon) * epsilon;
56  ccwerrboundB = (2.0 + 12.0 * epsilon) * epsilon;
57  ccwerrboundC = (9.0 + 64.0 * epsilon) * epsilon * epsilon;
58  o3derrboundA = (7.0 + 56.0 * epsilon) * epsilon;
59  o3derrboundB = (3.0 + 28.0 * epsilon) * epsilon;
60  o3derrboundC = (26.0 + 288.0 * epsilon) * epsilon * epsilon;
61  iccerrboundA = (10.0 + 96.0 * epsilon) * epsilon;
62  iccerrboundB = (4.0 + 48.0 * epsilon) * epsilon;
63  iccerrboundC = (44.0 + 576.0 * epsilon) * epsilon * epsilon;
64  isperrboundA = (16.0 + 224.0 * epsilon) * epsilon;
65  isperrboundB = (5.0 + 72.0 * epsilon) * epsilon;
66  isperrboundC = (71.0 + 1408.0 * epsilon) * epsilon * epsilon;
67 
68 
69 
70  FILE * pFile = fopen ("PredicatesInit.hpp","w");
71 
72  fputs("/* This file was generated automatically by PredicatsInit.c */\n"
73 "// ========================================================================================\n"
74 "// ApproxMVBB\n"
75 "// Copyright (C) 2014 by Gabriel Nützi <nuetzig (at) imes (d0t) mavt (d0t) ethz (d0t) ch>\n"
76 "//\n"
77 "// This Source Code Form is subject to the terms of the Mozilla Public\n"
78 "// License, v. 2.0. If a copy of the MPL was not distributed with this\n"
79 "// file, You can obtain one at http://mozilla.org/MPL/2.0/.\n"
80 "// ========================================================================================\n", pFile);
81  fprintf(pFile,"static double splitter = %f;\n", splitter);
82  fprintf(pFile,"static double resulterrbound = %.16g;\n", resulterrbound);
83  fprintf(pFile,"static double ccwerrboundA = %.16g;\n", ccwerrboundA);
84  fprintf(pFile,"static double ccwerrboundB = %.16g;\n", ccwerrboundB);
85  fprintf(pFile,"static double ccwerrboundC = %.16g;\n", ccwerrboundC);
86  fprintf(pFile,"static double o3derrboundA = %.16g;\n", o3derrboundA);
87  fprintf(pFile,"static double o3derrboundB = %.16g;\n", o3derrboundB);
88  fprintf(pFile,"static double o3derrboundC = %.16g;\n", o3derrboundC);
89  fprintf(pFile,"static double iccerrboundA = %.16g;\n", iccerrboundA);
90  fprintf(pFile,"static double iccerrboundB = %.16g;\n", iccerrboundB);
91  fprintf(pFile,"static double iccerrboundC = %.16g;\n", iccerrboundC);
92  fprintf(pFile,"static double isperrboundA = %.16g;\n", isperrboundA);
93  fprintf(pFile,"static double isperrboundB = %.16g;\n", isperrboundB);
94  fprintf(pFile,"static double isperrboundC = %.16g;\n", isperrboundC);
95  fclose(pFile);
96 
98 
99  return 0;
100 }
static double o3derrboundA
static double iccerrboundA
static double resulterrbound
static double isperrboundB
static double splitter
static double o3derrboundB
#define FPU_DECLARE
Definition: Rounding.hpp:24
int main(int, char *[])
static double o3derrboundC
static double isperrboundC
static double ccwerrboundA
static double isperrboundA
static double iccerrboundB
#define FPU_RESTORE
Definition: Rounding.hpp:32
static double ccwerrboundB
#define FPU_ROUND_DOUBLE
Definition: Rounding.hpp:28
static double ccwerrboundC
static double iccerrboundC


asr_approx_mvbb
Author(s): Gassner Nikolai
autogenerated on Mon Jun 10 2019 12:38:08