Re: sqrt C function

2001-08-15 Thread Dimitri Maziuk
* "J?rgen A. Erhard" ([EMAIL PROTECTED]) spake thusly: > > "Dimitri" == Dimitri Maziuk <[EMAIL PROTECTED]> writes: ... > No way in hell. As double has a 50+ bit mantissa, all ints smaller > than this (typical 4 byte long int) can be converted without loss. > (IEEE 754 53 bits mantissa, 10 bits

Re: sqrt C function

2001-08-14 Thread Jürgen A. Erhard
> "Dimitri" == Dimitri Maziuk <[EMAIL PROTECTED]> writes: Dimitri> * Craig Dickson ([EMAIL PROTECTED]) spake thusly: >> I don't see how. I see it as a legitimate compiler >> optimization. If you have "double f = 4;", and you compile 4 as >> a double-precision value rather than

Re: sqrt C function

2001-08-14 Thread Paul Scott
Dimitri Maziuk wrote: * Craig Dickson ([EMAIL PROTECTED]) spake thusly: ... (2) Is there any essential difference between the following two declarations: double f = 4; double f = 4.0; such that a conforming C compiler is prohibited from compiling them ^^

Re: sqrt C function

2001-08-14 Thread Craig Dickson
Dimitri Maziuk wrote: > Sorry, Craig, WTF cares what "a conforming" compiler is "not prohibited" > to do? Because that was the question under discussion: whether the standard allows a compiler to do that. Someone (I forget who now) thought not; I disagreed. > The question is "is my 'now even mo

Re: sqrt C function

2001-08-14 Thread Dimitri Maziuk
* Craig Dickson ([EMAIL PROTECTED]) spake thusly: ... > (2) Is there any essential difference between the following two > declarations: > > double f = 4; > double f = 4.0; > > such that a conforming C compiler is prohibited from compiling them ^^ ^^

Re: sqrt C function

2001-08-14 Thread dman
On Tue, Aug 14, 2001 at 09:03:32AM -0700, Craig Dickson wrote: [...] | But this is all quite irrelevant to the original question, the point of | which was, I think, missed by Dimitri Maziuk. Let's back off here and | restate the original problem, which was: [...] | You (dman) seem to be following D

Re: sqrt C function

2001-08-14 Thread Craig Dickson
dman wrote: > On Tue, Aug 14, 2001 at 07:34:26AM -0700, David Roundy wrote: > | On Mon, Aug 13, 2001 at 12:37:45PM -0500, Dimitri Maziuk wrote: > | > * Craig Dickson ([EMAIL PROTECTED]) spake thusly: > | > > I don't see how. I see it as a legitimate compiler optimization. If you > | > > have "doub

Re: sqrt C function

2001-08-14 Thread dman
On Tue, Aug 14, 2001 at 07:34:26AM -0700, David Roundy wrote: | On Mon, Aug 13, 2001 at 12:37:45PM -0500, Dimitri Maziuk wrote: | > * Craig Dickson ([EMAIL PROTECTED]) spake thusly: | > > I don't see how. I see it as a legitimate compiler optimization. If you | > > have "double f = 4;", and you co

Re: sqrt C function

2001-08-14 Thread David Roundy
On Mon, Aug 13, 2001 at 12:37:45PM -0500, Dimitri Maziuk wrote: > * Craig Dickson ([EMAIL PROTECTED]) spake thusly: > > Paul Scott wrote: > > > > > Well that may date me a little even though I am actively programming at > > > this moment. I will research this a little more. My logic would be it

Re: sqrt C function

2001-08-13 Thread Dimitri Maziuk
* Craig Dickson ([EMAIL PROTECTED]) spake thusly: > Paul Scott wrote: > > > Well that may date me a little even though I am actively programming at > > this moment. I will research this a little more. My logic would be it > > would break the rules of the language to assume that conversion. >

Re: sqrt C function(clarification)

2001-08-11 Thread Colin Watson
On Sat, Aug 11, 2001 at 03:44:17AM -0400, [EMAIL PROTECTED] wrote: > I'm sorry not to have provided more information in my first e-mail although > i'm very glad so many people responded to help, but i've done some more > testing: > > specifically i'm getting 'prase error in tmp/x' where x is a l

Re: sqrt C function(clarification)

2001-08-11 Thread Paul Scott
Shaul Karl wrote: I'm sorry not to have provided more information in my first e-mail although i'm very glad so many people responded to help, but i've done some more testing: specifically i'm getting 'prase error in tmp/x' where x is a long string of characters that tends to change on every

Re: sqrt C function(clarification)

2001-08-11 Thread Fredrik Jagenheim
On Sat, Aug 11, 2001 at 03:44:17AM -0400, [EMAIL PROTECTED] wrote: > I'm sorry not to have provided more information in my first e-mail although > i'm very glad so many people responded to help, but i've done some more > testing: > > specifically i'm getting 'prase error in tmp/x' where x is a l

Re: sqrt C function(clarification)

2001-08-11 Thread Shaul Karl
> I'm sorry not to have provided more information in my first e-mail although > i'm very glad so many people responded to help, but i've done some more > testing: > > specifically i'm getting 'prase error in tmp/x' where x is a long string of > characters that tends to change on every run of th

Re: sqrt C function

2001-08-10 Thread Paul Scott
Craig Dickson wrote: Paul Scott wrote: Well that may date me a little even though I am actively programming at this moment. I will research this a little more. My logic would be it would break the rules of the language to assume that conversion. I don't see how. I see it as a legitima

Re: sqrt C function

2001-08-10 Thread Craig Dickson
Paul Scott wrote: > Well that may date me a little even though I am actively programming at > this moment. I will research this a little more. My logic would be it > would break the rules of the language to assume that conversion. I don't see how. I see it as a legitimate compiler optimizatio

Re: sqrt C function

2001-08-10 Thread Paul Scott
Craig Dickson wrote: Paul Scott wrote: I doubt if this is your problem but on most compilers: double num; num = 4; is inefficient; It normally causes an integer constant 4 to be stored somewhere. Then when num = 4; is executed the integer 4 is converted to double every you execu

Re: sqrt C function

2001-08-10 Thread David Purton
On Fri, 10 Aug 2001 [EMAIL PROTECTED] wrote: > when i try to use the sqrt function in gcc 3.0, and the gcc that's standard > with 2.2r3 ( i forget the version) i get errors. here's some example code: > > #include > #include > > double num; > double num_root; > > int main () > { > num =

Re: sqrt C function

2001-08-10 Thread Craig Dickson
Paul Scott wrote: > I doubt if this is your problem but on most compilers: > > double num; > > num = 4; > > is inefficient; It normally causes an integer constant 4 to be stored > somewhere. Then when num = 4; is executed the integer 4 is converted > to double every you execute the

Re: sqrt C function

2001-08-10 Thread Craig Dickson
[EMAIL PROTECTED] wrote: > when i try to use the sqrt function in gcc 3.0, and the gcc that's standard > with 2.2r3 ( i forget the version) i get errors. here's some example code: > > #include > #include > > double num; > double num_root; > > int main () > { > num = 4; > num_root =

Re: sqrt C function

2001-08-10 Thread Alan Shutko
[EMAIL PROTECTED] writes: > when i try to use the sqrt function in gcc 3.0, and the gcc that's standard > with 2.2r3 ( i forget the version) i get errors. here's some example code: In general, you should post the exact errors when asking a question of this sort, since it helps people find your

Re: sqrt C function

2001-08-10 Thread Paul Scott
[EMAIL PROTECTED] wrote: when i try to use the sqrt function in gcc 3.0, and the gcc that's standard with 2.2r3 ( i forget the version) i get errors. here's some example code: #include #include double num; double num_root; int main () { num = 4; num_root = sqrt(num); return (0