aaaaaaaaaaaaaaaah! Integer division and MODulo. I get it. thx so much guys
------------------
Kind Regards
Mike
Announcement
Collapse
No announcement yet.
Fuzzy Math
Collapse
X
-
Result = Date/100
Remainder = Result - FIX(Result)
Code:Result = Date\ 100 ' integer divide "\" Remainder = Result MOD 100
Leave a comment:
-
-
Try :
Code:LOCAL Remainder AS DOUBLE LOCAL Result AS DOUBLE Result = Date/100 Remainder = Result - FIX(Result) MSGBOX "FIX( "+STR$(Remainder* 100)+") = " + STR$( FIX(Remainder* 100) )
------------------
Bernard Ertl
[This message has been edited by Bern Ertl (edited March 05, 2001).]
Leave a comment:
-
-
Fuzzy Math
Im doing simple division (moving the decimal place) for my Date to Julian Function (thanks Lance) and I found a bug which I traced down to this (run example)
Could someone tell what the heck is going on?
#COMPILE EXE "Fuzzy.exe"
GLOBAL Date AS LONG
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤'
FUNCTION PBMAIN
Date = 991209
' Year& = 1900 + Date/10000
' Month& = FIX((Date/10000 - FIX(Date/10000))*100)
' Day& = FIX((Date/100 - FIX(Date/100)) *100)
MSGBOX( "( "+STR$(Date/100)+" - "+STR$(FIX(Date/100))+" ) * 100 = "+STR$(FIX((Date/100 - FIX(Date/100))*100))+" !!!" )
END FUNCTION
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤'
------------------
Kind Regards
MikeTags: None
-
Leave a comment: