|
Post by Roger Cabo on Jan 7, 2024 17:52:09 GMT 1
Hi everyone, in the latest version of gb32 I have a strange issue. try this: Dim minutes% = 480 Dim H% = Int(minutes% / 60) MsgBox H% I'm expecting H%= 8 but it's 7This cause a lot wrong calculations in my date and time stuff. I hope this has no effect in the user data..
Can someone plz test with the same version of Gb32..
|
|
|
Post by (X) on Jan 7, 2024 18:09:17 GMT 1
The Int() function rounds down to nearest number.
GFA Help:
|
|
|
Post by (X) on Jan 7, 2024 18:10:46 GMT 1
Here are a few test results: $Library "gfawinx" $Library "UpdateRT" UpdateRuntime ' Patches GfaWin23.Ocx
Dim minutes% = 480 Dim Minutesperhour% = 60 Dim H% = Int(minutes% / 60)
Trace Int(480 / 60) Trace Int(minutes% / 60) Trace Int(CDbl(minutes%) / 60) Trace Int(CDbl(minutes%) / CDbl(60)) Trace Int(CSng(minutes%) / 60) Trace Int(CSng(minutes%) / CSng(60))
Trace CInt(480 / 60) Trace CInt(minutes% / 60) Trace CInt(CDbl(minutes%) / 60) Trace CInt(CDbl(minutes%) / CDbl(60)) Trace CInt(CSng(minutes%) / 60) Trace CInt(CSng(minutes%) / CSng(60))
Trace Int(minutes% / Minutesperhour)
Trace minutes% Trace minutes / 60
Output window:
|
|
|
Post by Roger Cabo on Jan 7, 2024 18:22:20 GMT 1
Thank you X!! Found the Bug.. In properties there floating point optimize DIV was enabled.. during with some tests with Sincos. Thank god.. I was about to ship my new update to customers.. because this bug would cause corrupt employer hours an a lot more terrible issues...
|
|
|
Post by (X) on Jan 7, 2024 18:30:37 GMT 1
Well look at that!
I was not expecting such different behaviour from the FP (floating point) Optimization options!
Good find!
I've been using these settings:
|
|
|
Post by Roger Cabo on Jan 7, 2024 18:34:38 GMT 1
Dim minutes% = 480 Dim H% = Int(minutes% / 60)
TRACE:(1):Int(480 / 60) = 8 TRACE:(2):Int(minutes% / 60) = 7 ... (definitely a wrong calculation)
I can not recommended to use any of the floating point optimizations.
|
|
|
Post by (X) on Jan 7, 2024 19:01:00 GMT 1
I find that when dealing with money most people are very forgiving and are perfectly happy to accept that mistakes will be made. No, wait... that's about launching people in rockets to the moon and such,
not about their salaries!
You definitely dodged a bullet there buddy!
|
|