This forum has been archived. All content is frozen. Please use KDE Discuss instead.

work with high decimal numbers in C++

Tags: None
(comma "," separated)
seymohsenfls
Registered Member
Posts
1
Karma
0
Hello guys. I have a code that calculates the eigenvalues of a matrix and work very well. but when I use a number with high decimal, that does not work well. the code is as follows:
Code: Select all
#include <iostream>
#include "Eigen/Dense"

using namespace std;
using namespace Eigen;

int main(){

// 3x3 array
    double arr1[][3]={{-4.41454283058227e-08,-4.15360517928287e-18,-2.08705000000000e-31},
                      {1,0,0},
                      {0,1,0}};

    MatrixXd array(3,3);

    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            array(i,j)=arr1[i][j];
        }
    }

    MatrixXcd eig = array.eigenvalues();
}

Can anyone help me about this?


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]