467,895 Members | 1,403 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,895 developers. It's quick & easy.

"Start" and "Start Without Debugging" give different results

A couple of days ago there was a thread "Returning the machine epsilon".

The responses in that thread suggested using Double.Epsilon or
Single.Epsilon. Since both these seem to return zero I thought I would try
to compute these epsilons myself. Using the following program fragment:

===================================
private void button4_Click(object sender, System.EventArgs e) {
float a;
float f= 1.0f;
float one= 1.0f;
do {
f/= 2.0f;
a= one+f;
} while (a>one);
Say("f="+FNum(f));
} // button4_Click

public static string FNum(float x){
return x.ToString("n20");
} // FNum

public static void Say(string x) {
MessageBox.Show(x);
} // Say
===================================

If I run this using Debug|Start I get:

f=0.00000005960464000000

which is probably the correct answer.

If I run this using Debug|Start Without Debugging I get:

f=0.00000000000000011102

which is probably Double.Epsilon.

Tiny changes to the above program fragment change this behavior.

I am using Microsoft Development Environment 2003, Version 7.1.3088 and
Microsoft .NET Framework 1.1, Version 1.1.4322 .

Any ideas?

--
Clive Tooth
http://www.clivetooth.dk
Nov 15 '05 #1
  • viewed: 1628
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Hal Vaughan | last post: by
1 post views Thread by Nick Ward | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.