Listener @lbutlr pointed out on Twitter that the sample solution to the challenge set in PBS 88 as I originally posted it in PBS 89 had a bug — it sometimes got its maths spectacularly wrong!

PBS 88 Solution Bug

It’s important to note that the bug did not affect all currencies, just some currencies.

The line of code for doing the currency conversion is supremely simple:

const convAmount = baseAmount * rate;

How on earth can there be a bug that is something so simple that only manifests for some currencies but not for others?

Read more

Tagged with: