| 1 | // Booster.cpp : Defines the entry point for the console application.
|
|---|
| 2 | //
|
|---|
| 3 |
|
|---|
| 4 | #include <boost/math/special_functions/gamma.hpp>
|
|---|
| 5 | #include <boost/format.hpp>
|
|---|
| 6 | #include <iostream>
|
|---|
| 7 | #include <math.h>
|
|---|
| 8 |
|
|---|
| 9 | int main()
|
|---|
| 10 | {
|
|---|
| 11 | using namespace boost::math::detail;
|
|---|
| 12 |
|
|---|
| 13 | for (double z = -10.0; z < 10.1; z += 0.1) {
|
|---|
| 14 | double result = sinpx(z);
|
|---|
| 15 | double result2 = z * sin(z * 3.14159265);
|
|---|
| 16 | bool error = abs(result - result2) > 0.001;
|
|---|
| 17 | auto errormsg = error ? "\t*** Error" : "";
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 | std::cout << boost::format ("%1$4.1f * sinpx (%1$4.1f * PI) is %2$11.8f\tC++ sin() is %3$11.8f%4%\n") % z % result % result2 % errormsg;
|
|---|
| 21 | }
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|