/* TRITIUM-PROVENANCE sha256=be8b9a4966b8e3d378bc7ff3b737b36a962a95ac6e180af50fce8aebb8d7b8c1 lang=c */ /* TRITIUM-HEIGHT high=0.18 mid=0.68 low=0.14 fns=8 */ #include #include // TRITIUM-PSEUDO fn=fsin //| fn fsin(x): //| return i * x_3 // TRITIUM-HEIGHT fn=fsin high=0.00 mid=0.59 low=0.41 double fsin(double x) { double pi; double two; double i; double x_6; double x_7; double x_2; double x_5; double x_4; double x_3; pi = 3.141592653589793; two = 6.283185307179586; i = x; while (i > pi) { i = (i - two); } while (i <= (-pi)) { i = (i + two); } x_6 = i * i; x_7 = x_6 * 2.7557319223985893e-06; x_2 = -0.0001984126984126984 + x_7; x_5 = 0.008333333333333333 + (x_6 * x_2); x_4 = -0.16666666666666666 + (x_6 * x_5); x_3 = 1.0 + (x_6 * x_4); return i * x_3; } // TRITIUM-PSEUDO fn=fcos //| fn fcos(x): //| return x_3 // TRITIUM-HEIGHT fn=fcos high=0.00 mid=0.59 low=0.41 double fcos(double x) { double pi; double two; double i; double x_6; double x_7; double x_5; double x_2; double x_4; double x_3; pi = 3.141592653589793; two = 6.283185307179586; i = x; while (i > pi) { i = (i - two); } while (i <= (-pi)) { i = (i + two); } x_6 = i * i; x_7 = x_6 * 2.48015873015873e-05; x_5 = -0.001388888888888889 + x_7; x_2 = 0.041666666666666664 + (x_6 * x_5); x_4 = -0.5 + (x_6 * x_2); x_3 = 1.0 + (x_6 * x_4); return x_3; } // TRITIUM-PSEUDO fn=fsqrt //| fn fsqrt(x): //| return 0.0 //| return i_2 // TRITIUM-HEIGHT fn=fsqrt high=0.00 mid=0.69 low=0.31 double fsqrt(double x) { int64_t i; int fcmp4; double i_2; double x_2; fcmp4 = x <= 0.0; if (fcmp4) { return 0.0; } else { i_2 = x; i = 0L; while (i < 8L) { x_2 = 0.5 * (i_2 + (x / i_2)); i_2 = x_2; i = (i + 1L); } return i_2; } } // TRITIUM-PSEUDO fn=haversine_f //| fn haversine_f(lat1, lon1, lat2, lon2): //| fsin(...) //| fcos(...) //| fsqrt(...) //| return x_2 // TRITIUM-HEIGHT fn=haversine_f high=0.71 mid=0.29 low=0.00 double haversine_f(double lat1, double lon1, double lat2, double lon2) { double x; double aa; double x_3; double bb; double h; double x_2; x = (lat2 - lat1) / 2.0; aa = fsin(x); x_3 = (lon2 - lon1) / 2.0; bb = fsin(x_3); h = ((aa * aa) + ((((fcos(lat1)) * (fcos(lat2))) * bb) * bb)); x_2 = 2.0 * (fsqrt(h)); return x_2; } // TRITIUM-PSEUDO fn=_atan_unit //| fn _atan_unit(a): //| return x_2 // TRITIUM-HEIGHT fn=_atan_unit high=0.00 mid=1.00 low=0.00 role=leaf_charset double _atan_unit(double a) { double t8; int64_t folded; double i; int fcmp9; double x_7; double x_6; double x_5; double x_3; double x_10; double x_8; double x; double x_4; double x_11; double x_2; double x_9; t8 = 0.41421356237309503; folded = 0L; i = a; fcmp9 = i > t8; if (fcmp9) { x_7 = 1.0 - i; x_6 = 1.0 + i; i = (x_7 / x_6); folded = 1L; } x_5 = i * i; x_3 = x_5 * -0.09090909090909091; x_10 = 0.1111111111111111 + x_3; x_8 = -0.14285714285714285 + (x_5 * x_10); x = 0.2 + (x_5 * x_8); x_4 = -0.3333333333333333 + (x_5 * x); x_11 = 1.0 + (x_5 * x_4); x_2 = i * x_11; if (folded == 1L) { x_9 = 0.7853981633974483 - x_2; x_2 = x_9; } return x_2; } // TRITIUM-PSEUDO fn=fatan_poly //| fn fatan_poly(z): //| _atan_unit(...) //| return r // TRITIUM-HEIGHT fn=fatan_poly high=0.10 mid=0.90 low=0.00 role=leaf_charset double fatan_poly(double z) { int64_t neg; int64_t swapped; double i; int fcmp7; double x_4; int fcmp11; double x_2; double r; double x; double x_3; neg = 0L; i = z; fcmp7 = i < 0.0; if (fcmp7) { x_4 = 0.0 - i; i = x_4; neg = 1L; } swapped = 0L; fcmp11 = i > 1.0; if (fcmp11) { x_2 = 1.0 / i; i = x_2; swapped = 1L; } r = _atan_unit(i); if (swapped == 1L) { x = 1.5707963267948966 - r; r = x; } if (neg == 1L) { x_3 = 0.0 - r; r = x_3; } return r; } // TRITIUM-PSEUDO fn=fatan2 //| fn fatan2(y, x): //| fatan_poly(...) //| return 0.0 //| return 0.0 //| return x_4 //| return x_6 //| return x_3 //| return fatan_poly_2 // TRITIUM-HEIGHT fn=fatan2 high=0.13 mid=0.87 low=0.00 role=leaf_charset double fatan2(double y, double x) { double i; int fcmp6; double x_7; double i_2; int fcmp11; double x_2; int fcmp16; int fcmp18; double fatan_poly_2; int fcmp25; double x_5; int fcmp32; int fcmp34; double x_4; double x_6; int fcmp40; double x_3; i = y; fcmp6 = i < 0.0; if (fcmp6) { x_7 = 0.0 - i; i = x_7; } i_2 = x; fcmp11 = i_2 < 0.0; if (fcmp11) { x_2 = 0.0 - i_2; i_2 = x_2; } fcmp16 = i_2 >= i; if (fcmp16) { fcmp18 = i_2 == 0.0; if (fcmp18) { return 0.0; } else { fatan_poly_2 = fatan_poly(i / i_2); } } else { fcmp25 = i == 0.0; if (fcmp25) { return 0.0; } else { x_5 = 1.5707963267948966 - (fatan_poly(i_2 / i)); fatan_poly_2 = x_5; } } fcmp32 = x < 0.0; if (fcmp32) { fcmp34 = y < 0.0; if (fcmp34) { x_4 = fatan_poly_2 - 3.141592653589793; return x_4; } else { x_6 = 3.141592653589793 - fatan_poly_2; return x_6; } } else { fcmp40 = y < 0.0; if (fcmp40) { x_3 = 0.0 - fatan_poly_2; return x_3; } else { return fatan_poly_2; } } } // TRITIUM-PSEUDO fn=bearing_f //| fn bearing_f(lat1, lon1, lat2, lon2): //| fsin(...) //| fcos(...) //| fatan2(...) //| return br // TRITIUM-HEIGHT fn=bearing_f high=0.49 mid=0.51 low=0.00 double bearing_f(double lat1, double lon1, double lat2, double lon2) { double l2; double l1; double dl; double dlon1; double sd; double lat2a; double cl2; double ya; double lat1a; double cl1; double lat2b; double sl2; double t1; double lat1b; double sl1; double lat2c; double cl2b; double dlon2; double cd; double t2a; double t2; double xa; double yy; double xx; double br; l2 = lon2; l1 = lon1; dl = l2 - l1; dlon1 = dl; sd = fsin(dlon1); lat2a = lat2; cl2 = fcos(lat2a); ya = sd * cl2; lat1a = lat1; cl1 = fcos(lat1a); lat2b = lat2; sl2 = fsin(lat2b); t1 = cl1 * sl2; lat1b = lat1; sl1 = fsin(lat1b); lat2c = lat2; cl2b = fcos(lat2c); dlon2 = dl; cd = fcos(dlon2); t2a = sl1 * cl2b; t2 = t2a * cd; xa = t1 - t2; yy = ya; xx = xa; br = fatan2(yy, xx); return br; }