#include <bits/stdc++.h>
using namespace std;
int main() {
int a[2] = {-1,1};
for (int i=0; i<2; i++){
cout<<exp(log(-1)-log(a[i]));
cout<<endl;
}
return 0;
}
output :- nan
nan
I am expecting output:- [1,-1]
I am trying to perform division using exp and log properties
New contributor
Harsh Gola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.