Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <stdio.h>
00012
00013
00014 #include "ApproxMVBB/GeometryPredicates/Rounding.hpp"
00015
00016
00017 int main (int , char * [])
00018 {
00019 FPU_DECLARE
00020
00021 double half = 0.5;
00022 double check = 1.0, lastcheck;
00023 int every_other = 1;
00024
00025 double epsilon = 1.0;
00026
00027 double splitter = 1.0;
00028
00029 double resulterrbound;
00030 double ccwerrboundA, ccwerrboundB, ccwerrboundC;
00031 double o3derrboundA, o3derrboundB, o3derrboundC;
00032 double iccerrboundA, iccerrboundB, iccerrboundC;
00033 double isperrboundA, isperrboundB, isperrboundC;
00034
00035 FPU_ROUND_DOUBLE;
00036
00037 epsilon = 1.0;
00038 splitter = 1.0;
00039
00040
00041
00042
00043 do {
00044 lastcheck = check;
00045 epsilon *= half;
00046 if (every_other) {
00047 splitter *= 2.0;
00048 }
00049 every_other = !every_other;
00050 check = 1.0 + epsilon;
00051 } while ((check != 1.0) && (check != lastcheck));
00052 splitter += 1.0;
00053
00054 resulterrbound = (3.0 + 8.0 * epsilon) * epsilon;
00055 ccwerrboundA = (3.0 + 16.0 * epsilon) * epsilon;
00056 ccwerrboundB = (2.0 + 12.0 * epsilon) * epsilon;
00057 ccwerrboundC = (9.0 + 64.0 * epsilon) * epsilon * epsilon;
00058 o3derrboundA = (7.0 + 56.0 * epsilon) * epsilon;
00059 o3derrboundB = (3.0 + 28.0 * epsilon) * epsilon;
00060 o3derrboundC = (26.0 + 288.0 * epsilon) * epsilon * epsilon;
00061 iccerrboundA = (10.0 + 96.0 * epsilon) * epsilon;
00062 iccerrboundB = (4.0 + 48.0 * epsilon) * epsilon;
00063 iccerrboundC = (44.0 + 576.0 * epsilon) * epsilon * epsilon;
00064 isperrboundA = (16.0 + 224.0 * epsilon) * epsilon;
00065 isperrboundB = (5.0 + 72.0 * epsilon) * epsilon;
00066 isperrboundC = (71.0 + 1408.0 * epsilon) * epsilon * epsilon;
00067
00068
00069
00070 FILE * pFile = fopen ("PredicatesInit.hpp","w");
00071
00072 fputs("/* This file was generated automatically by PredicatsInit.c */\n"
00073 "// ========================================================================================\n"
00074 "// ApproxMVBB\n"
00075 "// Copyright (C) 2014 by Gabriel Nützi <nuetzig (at) imes (d0t) mavt (d0t) ethz (d0t) ch>\n"
00076 "//\n"
00077 "// This Source Code Form is subject to the terms of the Mozilla Public\n"
00078 "// License, v. 2.0. If a copy of the MPL was not distributed with this\n"
00079 "// file, You can obtain one at http://mozilla.org/MPL/2.0/.\n"
00080 "// ========================================================================================\n", pFile);
00081 fprintf(pFile,"static double splitter = %f;\n", splitter);
00082 fprintf(pFile,"static double resulterrbound = %.16g;\n", resulterrbound);
00083 fprintf(pFile,"static double ccwerrboundA = %.16g;\n", ccwerrboundA);
00084 fprintf(pFile,"static double ccwerrboundB = %.16g;\n", ccwerrboundB);
00085 fprintf(pFile,"static double ccwerrboundC = %.16g;\n", ccwerrboundC);
00086 fprintf(pFile,"static double o3derrboundA = %.16g;\n", o3derrboundA);
00087 fprintf(pFile,"static double o3derrboundB = %.16g;\n", o3derrboundB);
00088 fprintf(pFile,"static double o3derrboundC = %.16g;\n", o3derrboundC);
00089 fprintf(pFile,"static double iccerrboundA = %.16g;\n", iccerrboundA);
00090 fprintf(pFile,"static double iccerrboundB = %.16g;\n", iccerrboundB);
00091 fprintf(pFile,"static double iccerrboundC = %.16g;\n", iccerrboundC);
00092 fprintf(pFile,"static double isperrboundA = %.16g;\n", isperrboundA);
00093 fprintf(pFile,"static double isperrboundB = %.16g;\n", isperrboundB);
00094 fprintf(pFile,"static double isperrboundC = %.16g;\n", isperrboundC);
00095 fclose(pFile);
00096
00097 FPU_RESTORE;
00098
00099 return 0;
00100 }