<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2006/02/72ee455a5f011374a71925238a2ed762"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2006-02-19T16:53:25"
  subject="Re: [Caml-list] What library to use for arbitrary precision decimals"
  prev="2006/02/34c5b33a2ce71032c5bfbac81e30432f"
  next="2006/02/92ca6367f5929b8a8d393bd551a0f41c"
  prev-in-thread="2006/02/34c5b33a2ce71032c5bfbac81e30432f"
  next-in-thread="2006/02/92ca6367f5929b8a8d393bd551a0f41c"
  prev-thread="2006/02/26e0e034e81973bfaabae58148b29f96"
  next-thread="2006/02/7ced1cf6716695b05c93739612f75c5d"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="What library to use for arbitrary precision decimals">
<msg 
  url="2006/02/e0d80c67993d25b72681b783bd13813a"
  from="Joshua Smith &lt;kognate@g...&gt;"
  author="Joshua Smith"
  date="2006-02-19T13:43:38"
  subject="What library to use for arbitrary precision decimals">
<msg 
  url="2006/02/6a4ece1ab3283a32cdfc79d59c82478d"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2006-02-19T15:44:16"
  subject="Re: [Caml-list] What library to use for arbitrary precision decimals">
<msg 
  url="2006/02/34c5b33a2ce71032c5bfbac81e30432f"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2006-02-19T16:38:42"
  subject="Re: [Caml-list] What library to use for arbitrary precision decimals">
<msg 
  url="2006/02/72ee455a5f011374a71925238a2ed762"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2006-02-19T16:53:25"
  subject="Re: [Caml-list] What library to use for arbitrary precision decimals">
<msg 
  url="2006/02/92ca6367f5929b8a8d393bd551a0f41c"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2006-02-19T17:01:16"
  subject="Re: [Caml-list] What library to use for arbitrary precision decimals">
<msg 
  url="2006/02/ea5f7ca7239b2b1d32ef4a745dbed037"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2006-02-19T17:13:26"
  subject="Re: [Caml-list] What library to use for arbitrary precision decimals">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2006/02/024932e2e2c8b5b06b83662881c27c24"
  from="Jeremy Shute &lt;shutej@g...&gt;"
  author="Jeremy Shute"
  date="2006-02-19T17:21:44"
  subject="Re: [Caml-list] What library to use for arbitrary precision decimals">
<msg 
  url="2006/02/463692f8dc009e6672589f4cbd97f837"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2006-02-19T18:31:14"
  subject="Re: [Caml-list] What library to use for arbitrary precision decimals">
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>


On Sun, 19 Feb 2006, Richard Jones wrote:

&gt;
&gt; Before we go too far down the currency track (where I agree, using
&gt; integers is the way to go), my actual requirement is for a natural
&gt; OCaml mapping for the PostgreSQL NUMERIC/DECIMAL type:
&gt;
&gt; http://www.postgresql.org/docs/current/interactive/datatype.html#DATATYPE-NUMERIC-DECIMAL
&gt;
&gt; The database can define types like NUMERIC(6,4) which means 6 decimal
&gt; digits in total, 4 of them after the decimal point -- for example,
&gt; 12.3456

Hmm.  There are problems definin that library.  What are the semantics? 
If I add a NUMERIC(6,4) (2 digits to the left of the point and 4 to the 
righ) and a NUMERIC(7,2) (5 digits to the left of the point and 2 to the 
right), what precision is the result?  NUMERIC(4,2) (2 digits to the left 
of the point and 2 to the right)?  NUMERIC(9,4) (5 digits to the left of 
the point and 4 digits to the right)?  How does roundoff work?  If I take 
the NUMERIC(6,4) number 62.0000 and multiply it by the NUMERIC(6,4) number 
02.0000, what answer do I get?  The NUMERIC(6,4) number 24.000?  The 
NUMERIC(7,4) number 124.000?  Or does it throw an exception?

&gt;
&gt; There doesn't seem to me to be a good natural map for this type in the
&gt; stdlib.

If decimal roundoff isn't important, I'd be tempted to go for floats.  I 
don't know if this is true or not.

Brian

</contents>

</message>

