What is the advantage of saving whole in the field that I want to save prices?

Asked

Viewed 37 times

2

I was reading about building RESTFUL API with Laravel, and I noticed an interesting flame that I once wondered if the way I always saved "money" in the database.

Is there a problem in saving as Double fields of type value?

The blog said, "Notice that price is an integer. PLEASE, I BEG YOU! NEVER STORE YOUR PRICE DATA AS DOUBLE!

ALWAYS STORE IT AS INTEGER!"

Reference: https://medium.com/@devlob/Creating-Apis-in-Laravel-5-5-using-api-Resources-9850c1b70efb

  • I think that answers: https://answall.com/questions/219211/qual-a-forma-correta-de-usar-os-tipos-float-double-e-decimal/219465#219465

  • Ok, that point on float/decimal, okay, but it says to use INTEGER... So...?

  • 1

    A fixed point number (decimal) and a whole is the same thing.

  • @Hananiamizrahi, any further doubt, I believe that commenting on the answers to the other question can result in great replicas. Mainly in Maniero’s reply, his knowledge has no end (already mine I squeezed everything to write that answer)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.