I've come across a scenario where I'd need to divide a number by 365.25 in assembler. Let's say we've a variable VARA that will have values ranges from 0 - 36525. I'd need to divide VARA by 365.25. Quotient part of the result is needed to do further processing of my logic.
Note that dividend will always be a numeric number and only divisor has the fractional part
Please help me lead to the solution for the same. Please advise me incase additional informations needed.
Yes...I was actually using it for "age calculation logic". Here the scenario is to calculate the age when birthdate is given.
What I've thought to achieve is (logic in highlevel) ....
TODAYDATE = (Current Year * 365) + (Current Month in days) + (Current Day)
BIRTHDATE = (B'day year * 365)+ (B'day month in days)+ (day)
AGE is calculated as (TODAYDATE - BIRTHDATE) / 365
The results are nearly okay. But it will not be perfect always as leapyear is not taking care. In googling, I got to understand that if 365.25 days are used (instead of 365) in above calculation, result will be almost accurate. Please advise me whether there is any better way to accomplish this to calculate age when b'day is given. It would be grateful if anyone has sample handy. Thanks in advance.