[Info-vax] ChatGPT

Arne Vajhøj arne at vajhoej.dk
Tue Dec 20 20:29:59 EST 2022


On 12/20/2022 8:23 PM, Arne Vajhøj wrote:
> There has been a lot of hype around ChatGPT recently.
> 
> But DCL people do not need to worry about their job.
> 
> https://www.linkedin.com/feed/update/urn:li:activity:7009460498299539456/

I obviously needed to try myself.

First two attempts:

$ scale = 100*1000*1000
$ nit = 1000
$ pi = 0
$ i = 1
$ sign = 1
$ loop:
$    if i .gt. nit then goto endloop
$    pi = pi + sign * scale / (2 * i - 1)
$    sign = -sign
$    i = i + 1
$    goto loop
$ endloop:
$ pi = 4 * pi
$ write sys$output f$fao("The value of pi is approximatetly: !SL.!8ZL", 
pi / scale, pi - (pi / scale) * scale)
$ exit

get 2 decimals correct (can be increased to 4 by increasing nit
to 100000, but then it becomes a CPU benchmark!)

$ scale1 = 100 * 1000
$ scale2 = 1000
$ scale = scale1 * scale2
$ nit = 100
$ pi = 0
$ i = 1
$ sign = 1
$ loop:
$    if i .gt. nit then goto endloop
$    pi = pi + sign * scale / (2 * i - 1)
$    sign = -sign
$    i = i + 1
$    goto loop
$ endloop:
$ pi = pi + sign * (nit * nit + 1) * scale1 / (4 * nit * nit * nit + 5 * 
nit) * scale2
$ pi = 4 * pi
$ write sys$output f$fao("The value of pi is approximatetly: !SL.!8ZL", 
pi / scale, pi - (pi / scale) * scale)
$ exit

get 4 decimals correct (and are still fast)

Arne

PS: No need to state that DCL is one of the worst possible
     languages for such a task.






More information about the Info-vax mailing list