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
k
NA
25
0
problem with data type
Dec 3 2008 1:02 PM
double temp = 0;
for (int i = 0; i < 20; i++)
temp += 0.05;
I thought the value of temp must be 1.0. But when I debug my program, I saw the value of temp was 1.0000000000000002.
I don't know why temp has a value like that. Anyone can explain it for me? I need to use the true value of temp (1.0) to compare with 1.
Reply
Answers (
2
)
Help with XML Serialization in C#
Instantiate a Class Multiple Times Dynamicly