<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="198331" data-post-id="198331">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="slouchpie" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/slouchpie/120/34819_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  slouchpie
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji only-emoji" alt=":wink:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="198331" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/money-libraries-which-do-you-use-and-why/36383/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-198331" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="198331"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="198380" data-post-id="198380">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="kip" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kip/120/1440_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  kip
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>ex_cldr Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I do try to be as clear as possible in documentation about the purpose and intent of <a href="https://github.com/kipcole9/money" rel="nofollow">ex_money</a>. Always happy to accept a PR that makes it clearer! (I’m the author).</p>
<h1><a name="p-198380-introduction-to-money-1" class="anchor" href="#p-198380-introduction-to-money-1" aria-label="Heading link" rel="nofollow"></a>Introduction to Money</h1>
<p>Money implements a set of functions to store, retrieve, convert and perform arithmetic<br>
on a <code>%Money{}</code> type that is composed of an <a href="https://www.iso.org/iso-4217-currency-codes.html" rel="nofollow">ISO 4217</a> currency code and a currency amount.</p>
<p>Money is opinionated in the interests of serving as a dependable library that can underpin accounting and financial applications.</p>
<p>How is this opinion expressed?</p>
<ol>
<li>
<p>Money must always have both a amount and a currency code.</p>
</li>
<li>
<p>The currency code must always be a valid <a href="https://www.iso.org/iso-4217-currency-codes.html" rel="nofollow">ISO4217</a> code. <a href="https://www.currency-iso.org/en/home/tables/table-a1.html" rel="nofollow">Current</a> and <a href="https://www.currency-iso.org/en/home/tables/table-a3.html" rel="nofollow">historical</a> currency codes can be used.  See the <a href="https://www.currency-iso.org/en/home/tables.html" rel="nofollow">ISO Currency</a> for more information. You can also identify the relevant codes by:</p>
<ul>
<li><code>Money.known_currencies/0</code> returns all the currency codes known to <code>Money</code></li>
<li><code>Money.known_current_currencies/0</code> returns the currency codes currently in use</li>
<li><code>Money.known_historic_currencies/0</code> returns the list of historic currency codes</li>
<li><code>Money.known_tender_currencies/0</code> returns the list of currencies known to be legal tender</li>
</ul>
</li>
<li>
<p>Money arithmetic can only be performed when both operands are of the same currency.</p>
</li>
<li>
<p>Money amounts are represented as a <code>Decimal</code>.</p>
</li>
<li>
<p>Money can be serialised to the database as a composite Postgres type that includes both the amount and the currency. For MySQL, money is serialized into a json column with the amount converted to a string to preserve precision since json does not have a decimal type. Serialization is entirely optional.</p>
</li>
<li>
<p>All arithmetic functions work on a <code>Decimal</code>. No rounding occurs automatically (unless expressly called out for a function, as is the case for <code>Money.split/2</code>).</p>
</li>
<li>
<p>Explicit rounding obeys the rounding rules for a given currency. The rounding rules are defined by the Unicode consortium in its CLDR repository as implemented by the hex package <a href="https://hex.pm/packages/ex_cldr" rel="nofollow">ex_cldr</a>. These rules define the number of fractional digits for a currency and the rounding increment where appropriate.</p>
</li>
<li>
<p>Money output string formatting output using the hex package <a href="https://hex.pm/packages/ex_cldr" rel="nofollow">ex_cldr</a> that correctly rounds to the appropriate number of fractional digits and to the correct rounding increment for currencies that have minimum cash increments (like the Swiss Franc and Australian Dollar)</p>
</li>
</ol> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="198380" data-batch-url="/posts/batch_likers">
                        14
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/money-libraries-which-do-you-use-and-why/36383/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-198380" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="198380"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="198395" data-post-id="198395">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="slouchpie" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/slouchpie/120/34819_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  slouchpie
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I think the only thing lacking is for each library to make some reference to the other.</p>
<p>For example…</p>
<p><code>:money</code> could have this in its README</p>
<blockquote>
<p>Looking for something more comprehensive and globally applicable? Look at <code>:ex_money</code></p>
</blockquote>
<p>and <code>:ex_money</code> could have this in its README</p>
<blockquote>
<p>Looking for something simple and lighter without any <code>:cldr</code> deps? Look at <code>:money</code></p>
</blockquote>
<p>something like that?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="198395" data-batch-url="/posts/batch_likers">
                        3
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/money-libraries-which-do-you-use-and-why/36383/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-198395" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="198395"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="199999" data-post-id="199999">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="lukaszsamson" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lukaszsamson/120/7671_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  lukaszsamson
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>ElixirLS Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>In my company (fintech domain) mostly Decimal as integrates nicely with ecto. The library used to be buggy (I and my coworkers authored a few PRs) but that’s no longer the case. The biggest problem with Decimal now is performance. In case of performance sensitive code we use plain old integers or even NIFs.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="199999" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/money-libraries-which-do-you-use-and-why/36383/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-199999" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="199999"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>