Skip to content

Commit 28cc70b

Browse files
committed
Adding source code.
1 parent 6251f08 commit 28cc70b

File tree

2 files changed

+272
-0
lines changed

2 files changed

+272
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.github.appbomination;
2+
3+
/**
4+
* This file is licensed under the following license.
5+
*
6+
* FAUST, INC. PROPRIETARY LICENSE:
7+
*
8+
* FAUST, INC. grants you a non-exclusive right to use, modify, and distribute
9+
* the file provided that (a) you distribute all copies and/or modifications of
10+
* this file, whether in source or binary form, under the same license, and (b)
11+
* you turn over your firstborn child to Faust, Inc. when he/she reaches
12+
* adulthood or acquires a black market value of not less than $100 USD,
13+
* whichever comes first.
14+
*
15+
* Copyright (C) 2016 Faust Inc. All, and I mean ALL rights are reserved.
16+
*
17+
* @author yevster
18+
*
19+
*/
20+
public class InsufficientKarmaException extends RuntimeException {
21+
public InsufficientKarmaException(String message) {
22+
super(message);
23+
}
24+
}
Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
package com.github.appbomination;
2+
3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
5+
6+
/**
7+
* This file is licensed under the Apache 2.0 License (except where otherwise indicated).
8+
*
9+
* Copyright (C) 2016 Faust Inc. All, and I mean ALL rights are reserved.
10+
* @author yevster
11+
*
12+
*/
13+
public class Main {
14+
private static Logger logger = LoggerFactory.getLogger(Main.class);
15+
public static void main(String[] args){
16+
logger.info("Started this thing");
17+
throw new InsufficientKarmaException("Unable to run application. Please verify your worthiness.");
18+
}
19+
20+
/*Everything below this comment is copied from Apache Commons Math v. 3.6.1,
21+
* https://git1-us-west.apache.org/repos/asf?p=commons-math.git;a=blob_plain;f=src/main/java/org/apache/commons/math3/util/FastMath.java;hb=16abfe5de688cc52fb0396e0609cb33044b15653
22+
*
23+
* Lines 142-363
24+
*/
25+
private static final double SINE_TABLE_A[] =
26+
{
27+
+0.0d,
28+
+0.1246747374534607d,
29+
+0.24740394949913025d,
30+
+0.366272509098053d,
31+
+0.4794255495071411d,
32+
+0.5850973129272461d,
33+
+0.6816387176513672d,
34+
+0.7675435543060303d,
35+
+0.8414709568023682d,
36+
+0.902267575263977d,
37+
+0.9489846229553223d,
38+
+0.9808930158615112d,
39+
+0.9974949359893799d,
40+
+0.9985313415527344d,
41+
};
42+
43+
/** Sine table (low bits). */
44+
private static final double SINE_TABLE_B[] =
45+
{
46+
+0.0d,
47+
-4.068233003401932E-9d,
48+
+9.755392680573412E-9d,
49+
+1.9987994582857286E-8d,
50+
-1.0902938113007961E-8d,
51+
-3.9986783938944604E-8d,
52+
+4.23719669792332E-8d,
53+
-5.207000323380292E-8d,
54+
+2.800552834259E-8d,
55+
+1.883511811213715E-8d,
56+
-3.5997360512765566E-9d,
57+
+4.116164446561962E-8d,
58+
+5.0614674548127384E-8d,
59+
-1.0129027912496858E-9d,
60+
};
61+
62+
/** Cosine table (high bits). */
63+
private static final double COSINE_TABLE_A[] =
64+
{
65+
+1.0d,
66+
+0.9921976327896118d,
67+
+0.9689123630523682d,
68+
+0.9305076599121094d,
69+
+0.8775825500488281d,
70+
+0.8109631538391113d,
71+
+0.7316888570785522d,
72+
+0.6409968137741089d,
73+
+0.5403022766113281d,
74+
+0.4311765432357788d,
75+
+0.3153223395347595d,
76+
+0.19454771280288696d,
77+
+0.07073719799518585d,
78+
-0.05417713522911072d,
79+
};
80+
81+
/** Cosine table (low bits). */
82+
private static final double COSINE_TABLE_B[] =
83+
{
84+
+0.0d,
85+
+3.4439717236742845E-8d,
86+
+5.865827662008209E-8d,
87+
-3.7999795083850525E-8d,
88+
+1.184154459111628E-8d,
89+
-3.43338934259355E-8d,
90+
+1.1795268640216787E-8d,
91+
+4.438921624363781E-8d,
92+
+2.925681159240093E-8d,
93+
-2.6437112632041807E-8d,
94+
+2.2860509143963117E-8d,
95+
-4.813899778443457E-9d,
96+
+3.6725170580355583E-9d,
97+
+2.0217439756338078E-10d,
98+
};
99+
100+
101+
/** Tangent table, used by atan() (high bits). */
102+
private static final double TANGENT_TABLE_A[] =
103+
{
104+
+0.0d,
105+
+0.1256551444530487d,
106+
+0.25534194707870483d,
107+
+0.3936265707015991d,
108+
+0.5463024377822876d,
109+
+0.7214844226837158d,
110+
+0.9315965175628662d,
111+
+1.1974215507507324d,
112+
+1.5574076175689697d,
113+
+2.092571258544922d,
114+
+3.0095696449279785d,
115+
+5.041914939880371d,
116+
+14.101419448852539d,
117+
-18.430862426757812d,
118+
};
119+
120+
/** Tangent table, used by atan() (low bits). */
121+
private static final double TANGENT_TABLE_B[] =
122+
{
123+
+0.0d,
124+
-7.877917738262007E-9d,
125+
-2.5857668567479893E-8d,
126+
+5.2240336371356666E-9d,
127+
+5.206150291559893E-8d,
128+
+1.8307188599677033E-8d,
129+
-5.7618793749770706E-8d,
130+
+7.848361555046424E-8d,
131+
+1.0708593250394448E-7d,
132+
+1.7827257129423813E-8d,
133+
+2.893485277253286E-8d,
134+
+3.1660099222737955E-7d,
135+
+4.983191803254889E-7d,
136+
-3.356118100840571E-7d,
137+
};
138+
139+
/** Bits of 1/(2*pi), need for reducePayneHanek(). */
140+
private static final long RECIP_2PI[] = new long[] {
141+
(0x28be60dbL << 32) | 0x9391054aL,
142+
(0x7f09d5f4L << 32) | 0x7d4d3770L,
143+
(0x36d8a566L << 32) | 0x4f10e410L,
144+
(0x7f9458eaL << 32) | 0xf7aef158L,
145+
(0x6dc91b8eL << 32) | 0x909374b8L,
146+
(0x01924bbaL << 32) | 0x82746487L,
147+
(0x3f877ac7L << 32) | 0x2c4a69cfL,
148+
(0xba208d7dL << 32) | 0x4baed121L,
149+
(0x3a671c09L << 32) | 0xad17df90L,
150+
(0x4e64758eL << 32) | 0x60d4ce7dL,
151+
(0x272117e2L << 32) | 0xef7e4a0eL,
152+
(0xc7fe25ffL << 32) | 0xf7816603L,
153+
(0xfbcbc462L << 32) | 0xd6829b47L,
154+
(0xdb4d9fb3L << 32) | 0xc9f2c26dL,
155+
(0xd3d18fd9L << 32) | 0xa797fa8bL,
156+
(0x5d49eeb1L << 32) | 0xfaf97c5eL,
157+
(0xcf41ce7dL << 32) | 0xe294a4baL,
158+
0x9afed7ecL << 32 };
159+
160+
/** Bits of pi/4, need for reducePayneHanek(). */
161+
private static final long PI_O_4_BITS[] = new long[] {
162+
(0xc90fdaa2L << 32) | 0x2168c234L,
163+
(0xc4c6628bL << 32) | 0x80dc1cd1L };
164+
165+
/** Eighths.
166+
* This is used by sinQ, because its faster to do a table lookup than
167+
* a multiply in this time-critical routine
168+
*/
169+
private static final double EIGHTHS[] = {0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1.0, 1.125, 1.25, 1.375, 1.5, 1.625};
170+
171+
/** Table of 2^((n+2)/3) */
172+
private static final double CBRTTWO[] = { 0.6299605249474366,
173+
0.7937005259840998,
174+
1.0,
175+
1.2599210498948732,
176+
1.5874010519681994 };
177+
178+
/*
179+
* There are 52 bits in the mantissa of a double.
180+
* For additional precision, the code splits double numbers into two parts,
181+
* by clearing the low order 30 bits if possible, and then performs the arithmetic
182+
* on each half separately.
183+
*/
184+
185+
/**
186+
* 0x40000000 - used to split a double into two parts, both with the low order bits cleared.
187+
* Equivalent to 2^30.
188+
*/
189+
private static final long HEX_40000000 = 0x40000000L; // 1073741824L
190+
191+
/** Mask used to clear low order 30 bits */
192+
private static final long MASK_30BITS = -1L - (HEX_40000000 -1); // 0xFFFFFFFFC0000000L;
193+
194+
/** Mask used to clear the non-sign part of an int. */
195+
private static final int MASK_NON_SIGN_INT = 0x7fffffff;
196+
197+
/** Mask used to clear the non-sign part of a long. */
198+
private static final long MASK_NON_SIGN_LONG = 0x7fffffffffffffffl;
199+
200+
/** Mask used to extract exponent from double bits. */
201+
private static final long MASK_DOUBLE_EXPONENT = 0x7ff0000000000000L;
202+
203+
/** Mask used to extract mantissa from double bits. */
204+
private static final long MASK_DOUBLE_MANTISSA = 0x000fffffffffffffL;
205+
206+
/** Mask used to add implicit high order bit for normalized double. */
207+
private static final long IMPLICIT_HIGH_BIT = 0x0010000000000000L;
208+
209+
/** 2^52 - double numbers this large must be integral (no fraction) or NaN or Infinite */
210+
private static final double TWO_POWER_52 = 4503599627370496.0;
211+
212+
/** Constant: {@value}. */
213+
private static final double F_1_3 = 1d / 3d;
214+
/** Constant: {@value}. */
215+
private static final double F_1_5 = 1d / 5d;
216+
/** Constant: {@value}. */
217+
private static final double F_1_7 = 1d / 7d;
218+
/** Constant: {@value}. */
219+
private static final double F_1_9 = 1d / 9d;
220+
/** Constant: {@value}. */
221+
private static final double F_1_11 = 1d / 11d;
222+
/** Constant: {@value}. */
223+
private static final double F_1_13 = 1d / 13d;
224+
/** Constant: {@value}. */
225+
private static final double F_1_15 = 1d / 15d;
226+
/** Constant: {@value}. */
227+
private static final double F_1_17 = 1d / 17d;
228+
/** Constant: {@value}. */
229+
private static final double F_3_4 = 3d / 4d;
230+
/** Constant: {@value}. */
231+
private static final double F_15_16 = 15d / 16d;
232+
/** Constant: {@value}. */
233+
private static final double F_13_14 = 13d / 14d;
234+
/** Constant: {@value}. */
235+
private static final double F_11_12 = 11d / 12d;
236+
/** Constant: {@value}. */
237+
private static final double F_9_10 = 9d / 10d;
238+
/** Constant: {@value}. */
239+
private static final double F_7_8 = 7d / 8d;
240+
/** Constant: {@value}. */
241+
private static final double F_5_6 = 5d / 6d;
242+
/** Constant: {@value}. */
243+
private static final double F_1_2 = 1d / 2d;
244+
/** Constant: {@value}. */
245+
private static final double F_1_4 = 1d / 4d;
246+
247+
}
248+

0 commit comments

Comments
 (0)