Urgent.News

What's breaking now, across thousands of outlets.

Tech

My calculators gave correct answers to the wrong questions, so I started asking back

When I tested my calculators the way people actually type, the first problems I found were not about wrong maths. The maths was right. The input was a different number from the one the person meant, and the page answered that number with full confidence. I made these tools, and this is what I changed so they ask back instead: https://instantfreetools.com/compound-interest-calculator/ A 5% rate…

When I tested my calculators by simulating real user input, I discovered that the issues weren't related to incorrect math calculations. The problem lay in the input itself—people often typed different numbers than they meant. My tools needed a change to address this issue. You can access the updated compound interest calculator at https://instantfreetools.com/compound-interest-calculator/.

Interest rates can appear in two ways—percentages like 5% or decimal form like 0.05. My compound interest field expects percentages, so 0.05 actually means 0.05%. The discrepancy between the two can be significant. For instance, $10,000 invested for 10 years at 5% compounded monthly results in $16,470.09, while at 0.05%, it becomes $10,050.12.

Both results are mathematically correct based on the input, but only one aligns with what the person intended. Simply multiplying numbers below 1 by 100 to convert them isn't an ideal solution. A 0.5% savings rate, for example, shouldn't be automatically turned into 50%.

Instead, the page keeps the input as typed and asks, "Using 0.05%. Did you mean 5%?" with a button to switch to the correct value. If the rate is above 0 and below 1, the page asks whether the user meant a larger percentage. For rates already above 1, no question appears. I added rounding to avoid displaying numbers like 7.000000000000001% instead of 7%.

Another example is the BMI calculator, which has a height field labeled in centimeters (cm). When I typed 1.75, which many people write as their height, it calculated a BMI of 228,571.4— clearly incorrect. I made a silent change to correct this by reading any value between 0 and 3 in the cm box as meters. The result then explicitly states, "Read 1.75 as 175 cm." This conversion is not hidden and helps prevent misunderstandings.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Drawing 320 lots in three.js: instancing, a window shader and two performance mistakes

We build a small 3D city in the browser with three.js and react-three-fiber. You can walk and drive through it. This is how the buildings are drawn, plus two performance mistakes we made. File names are given where they help. The city is a function of a seed The map is a 9 by 9 grid of blocks.

  • 320 lots arranged in 9x9 grid of blocks
  • InstancedMesh reduces draw calls from 1,430 to 1,100
  • Shader manages window sizes and placements

More from Saturday 7 November →