Login
Ratjoy.com » Forums » Suggestions, Technical Support and Feedback » Potential bug in the store

Potential bug in the store


John Smith
RJ: gummiworms
CO: Gummiworms

Post Rating: 16
+ / -

Total Posts: 3
Karma: 78
Joined: Jan 22, 2012
I was trying to set the price of something in the store to $2.30, and when it went through and said ok, the price changed automatically to $2.29, not exactly game breaking but possibly a bug?
Scott (Admin)
RJ: Ratan Joyce
CO: Ratan Joyce

Post Rating: 0
+ / -

Total Posts: 1175
Karma: 5083
Joined: Jan 13, 2012
Thanks John!

This one is interesting and something you wouldn't notice until it's being pointed out.

What essentially happened is client-side Javascript treated floating numbers somewhat badly:
Math.floor(2.3 * 100) = 229

You can test this by putting the following line in the URL (but some browsers may give you warnings for executing URL JS, so only do this if you know how)
javascript:alert(Math.floor(2.3 * 100));

For now I'll "hide" the problem by asking JS to add 0.005 to the pre-floored float, and I'll send you some salad for pointing this out.


You need to register or login to post a reply.