TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
crash
NA
3
0
What type of var to declare
May 17 2007 6:06 PM
Hi all Im writeing program that does some math with points and it seems like im good till i get up to a certian point about 8 digits then i get over run errors so i was wondering what would be the best way handle these large numbers (and also to display them as text with out useing scientific notation. here is an example of my source Random random = new Random(); float X1, X2, X3, Y1, Y2, Y3; //STEP3 MAKE RANDOM PNT1 X1 = random.Next(2,10000); Y1 = random.Next(2,10000); //STEP2 MAKE PNT2 WITH CONSTANT ( FROM TEXT BOX) X2 = Convert.ToInt64(textBox7.Text); Y2 = 0; X3 = 1; Y3 = 1; //STEP4 GET SLOPE FROM PNT1 AND PNT2 float slope = (Y2 - Y1) / (X2 - X1); float t = random.Next(2,10000); //STEP5 GET RANDOM POINT ALONG LINE MADE PNT1 AND PNT2 X3 = t + X2; Y3 = t * slope + Y2; //float p = random.Next(1); // X3 = X1+(1-p)*X2; // Y3 = p * Y1 + (1 - p) * 2; //OUTPUT TO TEXTBOX textBox5.Text = t.ToString(); textBox6.Text = slope.ToString(); textBox1.Text = X1.ToString(); textBox2.Text = Y1.ToString(); textBox3.Text = X2.ToString(); textBox4.Text = Y2.ToString(); textBox9.Text = X3.ToString(); textBox8.Text = Y3.ToString();
Reply
Answers (
1
)
Flow Control with Exception Handling
system.StackOverFlowException in System.windows.forms.dll for no valid reason I can see