Problema matematico

Hello everyone,
If math isn't an opinion, then something's wrong. Basically, I use this button when I want to add a day I didn't do my daily meditation.
So, after running a procedure that calculates the days since March 25, 2024, I proceed as follows:
LblDaysDone = LblDaysElapsed (688) - LblDaysNotDone (4)
LblDaysDone = 661 and not 684! How is that possible?
Regards
Nicola

While using Do it you have to follow the correct sequence
If you forget Do it on step 3 then nothing will be calculated

Taifun

The same error obviously also appears in the APK

Well, we know it should work, so something goofy going on in your project:

I can't figure out where the problem is

I see in Screen1.Initialize you are setting Label2.Text to the current date.
You extract duration between Label1 and Label2, but you have not set Label1.Text to anything.

How do we know what's in it?

1 Like

Label1 refers to the date of 03.25.2024, the start of the meditation.

Try by swapping the bild as it might be corrupted

Apply Do It to everything feeding the clock duration to days block.

Sorry nicola, nothing against your "string math", but when you click BtnAggiungi you are updating your calculation ( and database ), but if you stay 9 days without clicking it, you should be in the situation shown in the screenshot you posted ( so don't be lazy ).

P.S.
for "string math" I refer to the fact that you are using labels as variables and doing calculations between strings, it works but... I'm old style, I prefer 64 bits integers ( if I'm not wrong ai2 uses 64 bits for an integer, which is enough for everyday tasks ; - )

As I showed in my example blocks, use variables, not labels. Labels for display, variables for calculations.

1 Like

See

for an example of AI2 exact integer math, with unlimitted digits.

After several years, I realize that I made a fool of myself. :upside_down_face:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.