comparison error

Blitz3D Forums/Blitz3D Programming/comparison error

Blitz3D rounds the displayed values to six digits.
In your example both numbers are rounded to 14.1430 and then final 0 is removed.

So x and b look the same, but in fact x is a little bigger than b.
Here are the same numbers, but now you can see the small difference:

Graphics 800,600
SetBuffer BackBuffer()

Local intervalx#[20]
Local temp0#,temp1#,temp2#,tempc%,b#
x#=14.143

xmax#=15.051

h#=0.242
temp0=13.417
tempc=1
While (temp0<=xmax)
	temp2=temp0+h	
	intervalx[tempc]=temp2
	temp0=temp2
	tempc=tempc+1
Wend

b=intervalx[3]

; Blitz3D makes x and b look the same when displayed.

Print " x = " + x
Print " b = " + b
Print

; But x is really a little bigger.

Print " x - 14 = " + (x - 14)
Print " b - 14 = " + (b - 14)

WaitKey() : End