[Coco] Julian Date
Wayne Campbell
asa.rand at gmail.com
Wed May 24 00:31:40 EDT 2017
I just tried reversing the order of the arguments. Instead of 1900,4 I used
4,1900.
I still got a result of 0. Same with 100,1900 and 400,1900. I don't think
any of them should have no remainder, or even a whole number remainder.
On May 23, 2017 9:18 PM, "Wayne Campbell" <asa.rand at gmail.com> wrote:
I haven't. There are 2 versions of MOD in Basic09, one for real numbers,
the other for integers. Basic09 decides which one to use based on the
arguments. Whole number literals are treated as integers as long as they
fall into the valid range of integer values. Otherwise they are treated as
real numbers. When using variables, the data type determines real or
integer. BYTE variables are expanded into integers.
I have tried other year values, like 2100 and 2300. It still reports that
the modulus of the division by 400 is 0. This is a bug in MOD.
On May 23, 2017 9:08 PM, "Arthur Flexser" <flexser at fiu.edu> wrote:
> Could it be that this version of MOD expects one or both of its arguments
> to be floating point numbers? If the algorithm by which it calculates
> MOD(i,m) starts by dividing i by m, it won't work if the division returns
> only an integer, discarding the remainder, as would be normal with integer
> division. In this case MOD(i,m) should return zero for any pair of
> integers.
>
> This seems like a long shot, but have you tried other arguments to see if
> they DON'T return zero?
>
> Art
>
> On Tue, May 23, 2017 at 11:39 PM, Wayne Campbell <asa.rand at gmail.com>
> wrote:
>
> > The month, day and year variables are integers.
> >
> > On May 23, 2017 8:35 PM, "Walter Zambotti" <zambotti at iinet.net.au>
> wrote:
> >
> > > So unless one of those value is considered a byte... However if as you
> > > say you are using constants in the expression this should never be the
> > case.
> > >
> > > -----Original Message-----
> > > From: Coco [mailto:coco-bounces at maltedmedia.com] On Behalf Of Walter
> > > Zambotti
> > > Sent: Wednesday, 24 May 2017 11:33 AM
> > > To: 'CoCoList for Color Computer Enthusiasts' <coco at maltedmedia.com>
> > > Subject: Re: [Coco] Julian Date
> > >
> > > The result of 1900 MOD 400 should always be 300 as it 100 short of the
> > > next 400 at 2000.
> > >
> > > -----Original Message-----
> > > From: Coco [mailto:coco-bounces at maltedmedia.com] On Behalf Of Wayne
> > > Campbell
> > > Sent: Wednesday, 24 May 2017 11:29 AM
> > > To: CoCoList <coco at maltedmedia.com>
> > > Subject: Re: [Coco] Julian Date
> > >
> > > I have the procedure working, mostly. Two problems.
> > >
> > > 1. Result shows 1.5 days more than the correct Julian day.
> > > 2. I have found a bug in the MOD function (integer version). If you
> type:
> > >
> > > PRINT MOD(1900,400)
> > >
> > > The result is 0. It should not be 0 on 1900. There should be a
> remainder
> > > of 3, or .75.
> > >
> > > You can verify this by running Basic09, creating a new procedure,
> typing
> > > in the above instruction, closing the editor and running the
> procedure. I
> > > was shocked when I found this. I never expected it.
> > >
> > > Wayne
> > >
> > >
> > > On May 23, 2017 7:37 PM, "Luis Fernández" <luis46coco at hotmail.com>
> > wrote:
> > >
> > > > OR
> > > >
> > > >
> > > > FUNCTION FechaJulDMA (tjul, dd, mm, aa) T = tjul + 62
> > > > t2 = FIX(T / 1461) * 4 + 1700
> > > > t1 = T MOD 1461
> > > > IF t1 > 365 THEN
> > > > t1 = t1 - 1
> > > > oa = FIX(t1 / 365)
> > > > t1 = t1 MOD 365
> > > > END IF
> > > > aa = t2 + oa
> > > > dias = t1 + 1
> > > > dd = dias
> > > > swb = 1 - SGN(oa)
> > > > IF dd > 212 + swb THEN dd = dd + 30
> > > > IF dd > 59 + swb THEN dd = dd + 2 - swb mm = FIX(dd / 61) * 2 + 1 dd
> =
> > > > dd MOD 61 IF dd > 31 THEN mm = mm + 1: dd = dd - 31 IF mm > 7 THEN mm
> > > > = mm - 1 FechaJulDMA = dias END FUNCTION
> > > >
> > > >
> > > >
> > > > ------------------------------------------------------------
> > > > ---------------------
> > > >
> > > > Making CoCoDskUtil V 1.X.X, Scan magazines and organize maltedmedia
> > > >
> > > > http://cococoding.com/cocodskutil/ Thank Aaron Wolfe
> > > >
> > > > http://www.tandycoco.com<http://www.tandycoco.com/> Thank Brian
> Blake
> > > >
> > > > My personal blog: http://www.luis45ccs.blogspot.com,
> > > >
> > > > Excuse my English, I use google translator, my language is Spanish,
> > > > I'm Spanish but I live in Venezuela
> > > >
> > > > ------------------------------------------------------------
> > > > ---------------------
> > > >
> > > >
> > > > ________________________________
> > > > De: Coco <coco-bounces at maltedmedia.com> en nombre de phillip taylor
> <
> > > > ptaylor2446 at gmail.com>
> > > > Enviado: martes, 23 de mayo de 2017 08:38 p.m.
> > > > Para: CoCoList for Color Computer Enthusiasts
> > > > Asunto: Re: [Coco] Julian Date
> > > >
> > > > Thank you but I did not write this code I got it off the internet.
> > > >
> > > > On Tue, May 23, 2017 at 8:15 PM, Mark McDougall
> > > > <msmcdoug at iinet.net.au>
> > > > wrote:
> > > >
> > > > > On 24/05/2017 8:46 AM, phillip taylor wrote:
> > > > >
> > > > > I am not sure what you mean by this "At least those skilled in
> > > > > BASIC09
> > > > >> will be able to fund an early retirement! ;)" but there is nothing
> > > > >> wrong with Basic09 or most of the other compilers that run under
> > > > >> Rsdos or Microsoft Windows. Cbasic will compile a basic program to
> > > > >> machine lanuage and will run 1 to 1000 faster then a program
> written
> > > in Basic.
> > > > >>
> > > > >
> > > > > Not sure how you took away that I was criticizing BASIC09 or any
> > > > > other language from that statement?!?
> > > > >
> > > > > I was referring to the COBOL programmers that retired off the back
> > > > > of the Y2K problem, implying that the situation would be the same
> in
> > > > > 2400 (ignoring the fact that it has been pointed out that it isn't
> > > > > actually a leap year) for BASIC09 programmers.
> > > > >
> > > > > Anyway, if one has to explain one's jokes then I guess they've
> > > > > fallen flat. :( I tried...
> > > > >
> > > > > Regards,
> > > > >
> > > > > --
> > > > > Mark McDougall
> > > > > <http://retroports.blogspot.com.au>
> > > > >
> > > > > --
> > > > > Coco mailing list
> > > > > Coco at maltedmedia.com
> > > > > https://pairlist5.pair.net/mailman/listinfo/coco
> > > > >
> > > >
> > > > --
> > > > Coco mailing list
> > > > Coco at maltedmedia.com
> > > > https://pairlist5.pair.net/mailman/listinfo/coco
> > > >
> > > > --
> > > > Coco mailing list
> > > > Coco at maltedmedia.com
> > > > https://pairlist5.pair.net/mailman/listinfo/coco
> > > >
> > >
> > > --
> > > Coco mailing list
> > > Coco at maltedmedia.com
> > > https://pairlist5.pair.net/mailman/listinfo/coco
> > >
> > >
> > > --
> > > Coco mailing list
> > > Coco at maltedmedia.com
> > > https://pairlist5.pair.net/mailman/listinfo/coco
> > >
> > >
> > > --
> > > Coco mailing list
> > > Coco at maltedmedia.com
> > > https://pairlist5.pair.net/mailman/listinfo/coco
> > >
> >
> > --
> > Coco mailing list
> > Coco at maltedmedia.com
> > https://pairlist5.pair.net/mailman/listinfo/coco
> >
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>
More information about the Coco
mailing list