Explain why Java and VB for that matter don't return 0....
Something to do with storing the sum first and how it is stored????
------------- Java -----------------
class artest
{
public static void main(String[] args)
{
float x = 150.01f;
float y = 10.01f;
float z = x + y - 160.02f;
System.out.println("Z: "+ z);
if (z==0)
System.out.println("works"
;
else
System.out.println("doesn't work"
;
}
}
----------------------------
------------ VB : --------------
Option Explicit
Private Sub Form_Load()
Dim x As Double
Dim y As Double
Dim z As Double
x = 150.01
y = 10.01
z = x + y - 160.02
Print z
If z = 0 Then
MsgBox "This really works: " & z
Else
MsgBox "this sucks: " & z
End If
Text1.Text = z
End Sub
Something to do with storing the sum first and how it is stored????
------------- Java -----------------
class artest
{
public static void main(String[] args)
{
float x = 150.01f;
float y = 10.01f;
float z = x + y - 160.02f;
System.out.println("Z: "+ z);
if (z==0)
System.out.println("works"
else
System.out.println("doesn't work"
}
}
----------------------------
------------ VB : --------------
Option Explicit
Private Sub Form_Load()
Dim x As Double
Dim y As Double
Dim z As Double
x = 150.01
y = 10.01
z = x + y - 160.02
Print z
If z = 0 Then
MsgBox "This really works: " & z
Else
MsgBox "this sucks: " & z
End If
Text1.Text = z
End Sub