[Coco] Julian Date

Gene Heskett gheskett at shentel.net
Wed May 24 01:37:56 EDT 2017


On Tuesday 23 May 2017 23:37:44 Wayne Campbell wrote:

> I was merely going by the .75 remainder in calculator. I didn't do the
> math to see it is 300 and not 3.
>
> Regardless, the Basic09 MOD function is broken as it returns 0 for the
> result.

It may be that how you are using the function is whats broken.

Have you tried initializing a 3 member array of INTEGER's, one with 1900, 
or whatever year you want to check, named "int1" and assign "int2"=400, 
then do a

int3=MOD(int1,int2)?

then to see it, print-using, using the correct formatting string, int3?

That is straight from my original 1983 revision G level 1 Basic09 green 
manual on page 8-5

Basic09 can handle keyboard input, but that keyboard input is normally 
assigned to a string variable as you type  which then must be made into 
an INTEGER in a different named integer with the VAL function before it 
can properly be used in a math function such as MOD(num1,num2)

Glaringly, it specifies the format of the MOD function as returning 
INTEGER or BYTE.  Apparently no REAL's allowed. And in this case both 
numbers are bigger than a BYTE.  So DIM them all as INTEGER's.

I've not used MOD in about a dozen coons ages, but I did, just for grins, 
do the K&R C books version in basic09 and got the same answers until I 
ran out of basic09's precision, which is about 8 digits less than our C 
compiler's output.  And both blew up running backwards in the year -4713 
BC.

> On May 23, 2017 8:32 PM, "Walter Zambotti" <zambotti at iinet.net.au>
> wrote:
>
> 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


Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>


More information about the Coco mailing list