-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest4.cpp
More file actions
63 lines (48 loc) · 935 Bytes
/
test4.cpp
File metadata and controls
63 lines (48 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <cstdio>
#include <cstdlib>
#include "ad4.hpp"
#include "vec3.hpp"
#include "sfinae.hpp"
static double drand53(){
return sqrt(drand48() * drand48());
}
template<>
void AD4<double>::print() const{
printf("%e (%A) %e (%A) %e (%A) %e (%A)\n", d0, d0, d1, d1, d2, d2, d3, d3);
}
template<>
AD4<double> AD4<double>::set_rand(){
d0 = drand53();
d1 = drand53();
d2 = drand53();
d3 = drand53();
return *this;
}
int main(){
srand48(20181219);
using AD = AD4<double>;
const AD x = AD().set_rand();
const AD y = AD().set_rand();
x.print();
y.print();
(x/y).print();
puts("");
x.print();
(y*(x/y)).print();
puts("");
(x*x).print();
x.sqr().print();
(x/y).print();
(x*y.inv()).print();
puts("");
x.inv().print();
(x.rsqrt() * x.rsqrt()).print();
puts("");
auto t = x.rsqrt();
auto t3 = t * t * t;
t3.print();
x.rsqrtCubed().print();
AD4<Vec3<double>> v = {{0,}, };
v = 1.0 * v;
return 0;
};