Logarithm in c++
#include<iostream> #define log10 2.30258509 using namespace std; double p(double x,int y) //power function { int i; double res=1.0; for(i=1;i<=y;i++) { res*=x; } return res; } int dton(double *b) //double to normalised to 10 form { int a = *b; int bits = 0; while (a != 0) { bits = bits + 1; *b = *b / 10; a= *b; } *b=(*b)*10; //cout<<"\n b in normalised form \n"<<b<<"* 10^"<<bits-1; return bits-1; }//end function void dton1(double b) //double to normalised to 10 form { int a = b; int bits = 0; while (a != 0) { bits = bits + 1; b = b / 10; a= b; } b=b*10; cout<<"\n b in normalised form \n"<<b<<"* 10^"<<bits-1; }//end function void dton(double b) //double to normalised to 2 form { ...
Comments
Post a Comment