Oxygen Basic
Programming => Example Code => Topic started by: Peter on November 24, 2010, 05:11:19 PM
-
Deleted
-
Hi Peter,
I get 11.999999999.. instead of 12
The normal rounding behaviour of the FPU is disrupted for some reason. I think it happens during GLUT initialisation - probably during the course of initialising fonts, where I have encountered this problem before.
It is fixed by inserting a finit instruction after binding GLUT
Charles
Bind glut32
(
glutCreateWindow glutCreateWindow
glutKeyboardFunc glutKeyboardFunc
glutDisplayFunc glutDisplayFunc
glutFullScreen glutFullScreen
glutMainLoop glutMainLoop
glutBitmapCharacter glutBitmapCharacter
)
finit
-
Hi Peter,
If you make Number Single rather than long, you will get the expected behaviour.
(Autoconversion from single to long rounds fractional values to the nearest integer )
Charles
Dim Num(4),Number as single
Dim a, as long
Num(1) = 12.8
Num(2) = 15.9
Num(3) = 18.7
Num(4) = 20.6
for a=1 to 4
Number = Num(a)
print "Number" + str(a) + " " + str(trunc(Number))
next
-
Thank you Peter!
This is new to me.
xRet = GetWindowLong hwnd, GWL_EXSTYLE
xRet = xRet Or WS_EX_LAYERED
SetWindowLong hwnd, -20, xRet
SetLayeredWindowAttributes, hwnd, 0, 128, LWA_ALPHA
Charles