Windows Phone 7 development

Posts tagged ‘Floating point’

statically typed vs dynamically typed – How to get 90% discount.

There are a lot pros and cons of diffrent typing, yet on the one hand static typing wins – security. Yes both can be more or less secure buy static typing tells you a lot about your code and prevents from bugs, certain types of bugs. Do you want to buy a new flashy notebook with 90% discount? Everybody does šŸ™‚

  1. find a victim. Website with on-line shop.
  2. Pick your laptop and start the order
  3. In this process fill out the amount textbox with value ‘.1’ (dot and one)

Since most of the systems calculate the final value of bill :

ValueOfOneLaptop x AmountOfLaptops = TotalAmount

If there is no valiadtion upon floating point TotalAmout will be 10% of a laptop’s value. How? .1 stands for 0.1 and thereforeĀ  0.1 gives you 90% discount :). Most likely shop engine is wirtten in PHP or Python so you have a lot of chance to get it pass through. A shop employee validates the orderĀ  and will not spot the little dot.

Brilliant isn’t it?

Web Devs need to bare in mind this.

Static vs Dynamic 1:0.

Ps Cheating is bad mkay

%d bloggers like this: