diff options
Diffstat (limited to 'example_float.cc')
-rw-r--r-- | example_float.cc | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/example_float.cc b/example_float.cc index fed91c7..4feea0e 100644 --- a/example_float.cc +++ b/example_float.cc @@ -7,20 +7,18 @@ using namespace std; using namespace vecmathlib; - - -int main(int argc, char** argv) -{ +int main(int argc, char **argv) { // Declare a float precision vector with an architecture-dependent // number of elements float32_vec x; // Set each element separately. This is inefficient and should be // avoided if possible, but we want to demonstrate it here anyway. - for (int i=0; i<float32_vec::size; ++i) x.set_elt(i, float(i)); + for (int i = 0; i < float32_vec::size; ++i) + x.set_elt(i, float(i)); float32_vec y = x + float32_vec(1.0); y = sqrt(y); float32_vec z = log(y); - + // Boolean vectors are closely related to either float or float // vectors, thus we need to make a distinction bool32_vec b = x < y; @@ -29,12 +27,12 @@ int main(int argc, char** argv) // corresponding to "float32_vec", and there is "int_vec" // correpsonding to "float32_vec". int32_vec i = convert_int(y); - + cout << "x=" << x << "\n"; cout << "y=" << y << "\n"; cout << "z=" << z << "\n"; cout << "b=" << b << "\n"; cout << "i=" << i << "\n"; - + return 0; } |