Thread: Square root
View Single Post
  #3 (permalink)  
Old December 12th, 2004, 03:28 PM
Ashleek007 Ashleek007 is offline
Authorized User
 
Join Date: Jan 2004
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Ashleek007
Default

Thanks for the help, that works, would i use the same method to use other mathmatical functions?

For example sin() would be

m_fSin=m_fSin+atof(m_sDisplay);
    m_sDisplay="";
    m_fSinRes = sin(m_fSin);
    char strSin[20];
    m_fmem=m_fSinRes;
    gcvt(m_fmem,6,strSin);
    for (int i = 0;i<20;i++)
    m_sDisplay = m_sDisplay+strSin[i];

    UpdateData(FALSE);

Ive just tried that and it compiles, but gives me a strange result when testing, i type 45 then sin() and the answer should be 0.707, yet i get 0.850904???????

Is this anything to do with the fact its a floating point number? 'just a guess by the way!'

Thanks
Ash

My new web design domain
www.askmultimedia.co.uk
Reply With Quote