Long double version of C's sqrt() function?
Page 1 of 111 Replies  3527 Views  Last Post: 19 November 2010  07:17 PM
#1
Long double version of C's sqrt() function?
Posted 19 November 2010  12:44 PM
Replies To: Long double version of C's sqrt() function?
#2
Re: Long double version of C's sqrt() function?
Posted 19 November 2010  01:42 PM
Why not pass just sqrt() a long double?
Read here the documentation
http://www.cplusplus...ary/cmath/sqrt/
How am I misunderstanding your question?
#3
Re: Long double version of C's sqrt() function?
Posted 19 November 2010  02:51 PM
If you are going to give me a neg rep then you need to give an explanation.
Why did I say that was not helpful?
Now you could have a perfectly valid reason for that down vote. Please tell us what it is.
Ahhh  I get it.
I was wrong. Well done.
Still would have been good for you to say why.
This post has been edited by janotte: 19 November 2010  02:59 PM
#4 Guest_Guest*
Re: Long double version of C's sqrt() function?
Posted 19 November 2010  02:52 PM
#5
Re: Long double version of C's sqrt() function?
Posted 19 November 2010  02:55 PM
#6
Re: Long double version of C's sqrt() function?
Posted 19 November 2010  03:01 PM
#7
Re: Long double version of C's sqrt() function?
Posted 19 November 2010  03:08 PM
Quote
In C, only the double version of this function exists with this name.
EDIT:
EDIT 2: Based on this 6yearold thread elsewhere, it looks to work with bcc32 version 5.6.4.
EDIT 3: Embarcadero's website doc, but not knowing your version, don't know how valid it is.
This post has been edited by JackOfAllTrades: 19 November 2010  03:14 PM
#8 Guest_Guest*
Re: Long double version of C's sqrt() function?
Posted 19 November 2010  03:09 PM
#9
Re: Long double version of C's sqrt() function?
Posted 19 November 2010  03:12 PM
#include <iostream> #include <math.h> using namespace std; int main() { cout.precision(25); double sq = 3.0; long double sql = 3.0; cout <<sqrt(sql) << " \t"<< sqrt(sq) << " \t"<< sqrtl(sql)<< " \t"<< sqrtl(sq)<< endl; cin.get(); return 0; }
output:
1.732050807568877193176604 1.732050807568877193176604 1.732050807568877293573725 1.732050807568877293573725
#10
Re: Long double version of C's sqrt() function?
Posted 19 November 2010  06:22 PM
Guest, on 20 November 2010  07:09 AM, said:
Correct. The '@ failbot' bit meant I was talking to a DIC member called 'failbot'
I was asking why they voted my answer down as unhelpful.
Later you pointed out that I was completely and utterly wrong. The down vote from 'failbot' was completely appropriate just as you giving me a down vote of your own (if you had voting rights  why not sign up as a member and get such rights?, it's free and makes participating on DIC a better experience) would also have been completely appropriate. I gave you useless, unhelpful advice. In DIC that should be noted as such with a down vote That's how things work here.
The rest of that was suggesting that it would have been more useful for the member 'failbot' to have explained why I was wrong. Just like you did and JackOfAllTrades said again later in the thread. That would have meant everyone reading this could have more quickly seen how I was utterly wrong and could have pointed and laughed just as they should and everyone could have more quickly seen my post as the useless twaddle that it was.
The other thing that 'failbot' missed out on by not giving their reason was allowing me, and possibly others, to give her/him positive votes for pointing out my blunder.
Sorry if this is hijacking your thread but I did want to respond to your question to assure you noone thought you
This post has been edited by janotte: 19 November 2010  06:26 PM
#11
Re: Long double version of C's sqrt() function?
Posted 19 November 2010  06:53 PM
Just out of curiosity and for future reference, if the sqrtl function had not been part of the C language, is there any way to view the actual source code that is used for things like sqrt? I was hoping I would be able to find it by looking in math.h, but not so. If I have to write macros for things like this in the future, it would be helpful to know where to look, or if that source code is even available for us mere mortals to view. Thanks again.
#12
Re: Long double version of C's sqrt() function?
Posted 19 November 2010  07:17 PM
