I think I made a mistake for BASIC. I don’t think you get to populate the first two arrays that way,
but in some program they would be populated at run time with the input received, so I guess that’s ok.
The addition is done the same way you were taught to do it on paper in primary school
You could insert a decimal point with a value such as $2E in the input arrays somewhere, which would also require you keep them aligned.
For the constant Pi2, it just goes between the first 6 and the 2. Then if the input had a decimal point, the array would have to be rotated so that
for this example, the decimal point value is also at index 4 int he array. Ignore it in calculation, but remember it’s index to be passed through to the output.
Still just as you were taught in school on paper. The decimal point is there on paper, but you do nothing with it other than also print it for the output.
In any case of course, PBP doesn’t actually know the input or the output result as any variable of it’s own, but could still display it on a screen.
Bookmarks