question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Price (and other monetary properties) in models should not be type double

See original GitHub issue

It’s generally a very-very bad idea to save money (prices, etc) in double type. There’s a decimal C# type just for mostly monetary purposes that won’t give you calculation, casting, rounding, comparing mistakes that real types will give from time to time. From what I see it’s classes:

  • ShopifyCharge,
  • ShopifyProductVariant,
  • ShopifyCustomer,
  • ShopifyLineItem,
  • ShopifyOrder,
  • ShopifyRecurringCharge,
  • ShopifyShippingLine,
  • ShopifyTaxLine,
  • ShopifyTransaction,
  • ShopifyUsageCharge

In case you have other things to do I can fix it on this or next weekend and pull-request.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nozzlegearcommented, Sep 28, 2016

Thanks for reporting this! I tend to get doubles and decimals confused, I don’t use them much in anything I’ve built for production. A pull request would certainly be welcome, otherwise I’ll get it when I have the chance.

0reactions
nozzlegearcommented, May 15, 2017

All doubles have been change to decimals in the 4.0 branch.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use money type in Entity Framework model first
I created a table that has a column called Amount and I set it as Decimal. I can't find where to set it...
Read more >
Model Monetary Data
There are several approaches to modeling monetary data in MongoDB using the ... the double BSON type), decimal128 does not approximate decimal values...
Read more >
Model Risk Management | Comptroller's Handbook | OCC.gov
Risk management for quantitative tools that do not meet the definition of a model ... Model risk should be managed like other types...
Read more >
What Is the Capital Asset Pricing Model (CAPM)?
The Capital Asset Pricing Model (CAPM) helps to calculate investment risk and what return on investment an investor should expect.
Read more >
Pricing Strategy
Pricing your product, giving complete and accurate quotations, choosing the terms of the sale, and selecting the payment method are critical elements.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found