473,385 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Simple Math Question

Can someone help me understand this? Given the following code:

Dim y As Single
y = 1.44
For x As Single = 0 To 9
Console.WriteLine(x + y)
Next

Why the strange values when x = 7 and 8? This seems to only happen when y =
1.44 or 2.44 though more testing might uncover more. Obviously the simple fix
is to do a round to 2 places, but I discovered that a little after the fact.
Is this a bug? Thanks!

Doug
Nov 21 '05 #1
0 868

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Rob | last post by:
He , I need to generate some random numbers, right now I am using: Random pk = new Random(); int a = pk.nextInt(540); and wondering if there is any other methods in java to generate random...
20
by: drs | last post by:
Hi, I am trying to find all lists of length x with elements a, b, and c. To this end, I have created the class below, but it is not quite working and I am having trouble figuring out what to...
2
by: Senraba | last post by:
I would like to have a 600 X 400 window open with search results from CPanel's Entropy Search form. I have the following in the <HEAD> tag: <script language="javascript"...
2
by: Webdiyer | last post by:
Hi, We all know that the return value of Math.Log(8,2) is 3,but how about (int)Math.Log(8,2)? On my machine,the return value of (int)Math.Log(8,2) is strange enough! it's not 3 but 2 ! I've...
1
by: Phillip Vong | last post by:
Newbie here trying to learn. Using VS2005 / learning in VB.NET for an ASPX page. Sorry for this simple question. I have a Gridview1 with 2 columns. I added a 3rd column and all I want to do...
1
by: macklin01 | last post by:
Hi, everybody. I'm trying to do some last cleaning up on the following php page I wrote: http://www.math.uci.edu/~pmacklin/Publications.php This URL parses an XML file of publications: ...
0
by: sean | last post by:
I'm trying to create a "rubber band" rectangle effect on my form. Private Sub HighlightSectionOfTrack(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles...
5
by: gray_slp | last post by:
I am designing a web survey using surveymonkey.com and discovered I could use javascript to modify their standard question formats much the same as can be done in myspace. I used this feature to...
22
by: giordan | last post by:
Hi all! I've wrote this code: <script type="text/javascript"> var largImg; var altImg; var txtTop = '<b>Ottima scelta!</b> Ora compila il form e premi "Ricevi banner". Il...
17
by: Lenni | last post by:
Hi, I'm currently writing a web application for bicycle wheel builders that calculate the spoke length for all sorts of variations of hubs and rims. I have translated the formula from an...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.