mardi 4 avril 2017

c++

So I compiled and ran the program:

#include <iostream>
#include <cmath>
#include <complex>
#include <string>
using namespace std;
int main()
{
     complex<double> cd(3, 4);
     cout << "sin" << cd << " = " << sin(cd) << endl;
}// g++ -g -std=c++11 -Wfatal-errors sin.cpp

which returned the output: sin(3,4) = (3.85374,-27.0168)

I then double checked with: http://ift.tt/2nYvEkR

which returns: 3.85373803791937732161752894046373066706827494698903495676... - 27.0168132580039344880975437549921522633638656897651847059... i

which has a different sign on the imaginary part. And my question is what am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire