There's a problem with storing currency with float?
Dec 13, 2014
8
Level 2
Weird float to string problem, trying to charge Stripe a 1/100000th of a penny
The screenshot says it all. The stored value is indeed a float:
http://puu.sh/dtgD7/ef672e2040.png
And this is what I'm trying to charge stripe apparently
Level 1
"If I had a dime for every time I've seen someone use FLOAT to store currency, I'd have $999.997634" -- Bill Karwin
Nah, don't use FLOAT to store monetary values. Try to change it to DECIMAL(8,2) or better – keep values in cents (INT field) and use:
1 like
Please or to participate in this conversation.