AI Compare Ninja AI Compare Ninja

Compare AI tools. Use prompts and skills.

Language
EN

Handle money amounts correctly in code

Prompt that reviews how money amounts are stored and rounded and sets rules with test cases. Paste it into an AI tool of your choice, which then reviews how money amounts are handled.

Topic
Apps & prototypes
Type
Prompt
Level
Intermediate
Time
about 10 min

Results depend on the tool, the model and what you enter.

Result preview

Example: written by our editors, not real AI output.

Finding: cart.js, line 42 → price stored as float Rule: store amounts as whole cents, round only in calculate_total() Test: €100.00 in 3 instalments → 33.34 + 33.33 + 33.33 = 100.00 Question for the tax adviser: round tax per line or on the total?

Fill in

What you type stays in this browser window. We store and send nothing.

Where are amounts calculated?
What do you work with?
What have you noticed?

Your prompt

This is an instruction for an AI, not the result itself.

Where this prompt works

These AI tools are a good fit for this prompt:

How to use it

  1. Fill in the fields or tap a suggestion. Leave out names, addresses and other personal data.
  2. Copy the finished prompt into an AI tool of your choice.
  3. Split 100.00 into three and add the parts back up. If the result is not exactly 100.00, a rule for the remainder is missing.

Why does this work?

Floating-point numbers cannot represent many decimal amounts exactly, and every place rounds differently. A fixed data type, one rounding rule in one place and tests for edge cases prevent differences that are painful to track down later.

Tips

  • General technical help, not tax advice. If you are unsure how taxes must be rounded, check with your tax adviser.

Also a good fit

You may use our prompts freely, including at work. Please do not republish them as your own collection. We give no warranty for AI results; check them yourself. Terms of use