<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 10.00.9200.16521"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=113503919-18032013><FONT color=#0000ff
size=2 face=Arial>Exactly my opinion, too. Many
thanks.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=113503919-18032013><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=113503919-18032013><FONT color=#0000ff
size=2 face=Arial>Mike </FONT></SPAN></DIV><BR>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV lang=en-us class=OutlookMessageHeader dir=ltr align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> Ian McIntosh [mailto:ianm@ca.ibm.com]
<BR><B>Sent:</B> 18 March 2013 19:25<BR><B>To:</B> Mike
Cowlishaw<BR><B>Cc:</B> 'CFP'<BR><B>Subject:</B> Re: [Cfp-interest] C
operators<BR></FONT><BR></DIV>
<DIV></DIV>
<P><FONT size=2 face=sans-serif>Comparing a BFP and a DFP value for equality
requires converting one to the other. With BFP to BFP or DFP to DFP, if
they are different precisions you can widen the lower precision to match the
other. BFP to DFP or DFP to BFP is troublesome because when the formats
are the same size one has a larger exponent range but the other has more
precision. Which way should you convert? The decision was to make
the user convert and do a same-base comparison, with the hope that the user
will know more about the application's needs and whether exponent range or
fraction precision is more important than a compiler
would.</FONT><BR><BR><FONT size=2 face=sans-serif>If you really cared enough
you could get a better result by checking whether an overflow will or won't
happen and doing a different conversion and comparison depending on
that.</FONT><BR><BR><FONT size=2 face=sans-serif>- Ian McIntosh
IBM Canada Lab Compiler Back
End Support and Development<BR></FONT><BR><BR><IMG border=0
alt='Inactive hide details for "Mike Cowlishaw" ---03/18/2013 10:25:11 AM---Just got the attached request from someone implementing '
src="cid:113503919@18032013-0D76" width=16 height=16><FONT color=#424282
size=2 face=sans-serif>"Mike Cowlishaw" ---03/18/2013 10:25:11 AM---Just got
the attached request from someone implementing a decimal arithmetic library; I
think it's a</FONT><BR><BR>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR vAlign=top>
<TD width="1%"><IMG border=0 alt="" src="cid:113503919@18032013-0D7D"
width=96 height=1><BR>
<UL style="PADDING-LEFT: 4pt"><FONT color=#5f5f5f size=1
face=sans-serif>From:</FONT></UL></TD>
<TD width="100%"><IMG border=0 alt="" src="cid:113503919@18032013-0D7D"
width=1 height=1><BR><FONT size=1 face=sans-serif>"Mike Cowlishaw"
<mfc@speleotrove.com></FONT></TD></TR>
<TR vAlign=top>
<TD width="1%"><IMG border=0 alt="" src="cid:113503919@18032013-0D7D"
width=96 height=1><BR>
<UL style="PADDING-LEFT: 4pt"><FONT color=#5f5f5f size=1
face=sans-serif>To:</FONT></UL></TD>
<TD width="100%"><IMG border=0 alt="" src="cid:113503919@18032013-0D7D"
width=1 height=1><BR><FONT size=1 face=sans-serif>"'CFP'"
<cfp-interest@ucbtest.org></FONT></TD></TR>
<TR vAlign=top>
<TD width="1%"><IMG border=0 alt="" src="cid:113503919@18032013-0D7D"
width=96 height=1><BR>
<UL style="PADDING-LEFT: 4pt"><FONT color=#5f5f5f size=1
face=sans-serif>Date:</FONT></UL></TD>
<TD width="100%"><IMG border=0 alt="" src="cid:113503919@18032013-0D7D"
width=1 height=1><BR><FONT size=1 face=sans-serif>03/18/2013 10:25
AM</FONT></TD></TR>
<TR vAlign=top>
<TD width="1%"><IMG border=0 alt="" src="cid:113503919@18032013-0D7D"
width=96 height=1><BR>
<UL style="PADDING-LEFT: 4pt"><FONT color=#5f5f5f size=1
face=sans-serif>Subject:</FONT></UL></TD>
<TD width="100%"><IMG border=0 alt="" src="cid:113503919@18032013-0D7D"
width=1 height=1><BR><FONT size=1 face=sans-serif>[Cfp-interest] C
operators</FONT></TD></TR>
<TR vAlign=top>
<TD width="1%"><IMG border=0 alt="" src="cid:113503919@18032013-0D7D"
width=96 height=1><BR>
<UL style="PADDING-LEFT: 4pt"><FONT color=#5f5f5f size=1
face=sans-serif>Sent by:</FONT></UL></TD>
<TD width="100%"><IMG border=0 alt="" src="cid:113503919@18032013-0D7D"
width=1 height=1><BR><FONT size=1
face=sans-serif>cfp-interest-bounces@oakapple.net</FONT></TD></TR></TBODY></TABLE>
<HR style="COLOR: #8091a5" align=left SIZE=2 width="100%" noShade>
<BR><BR><BR><FONT color=#0000ff size=2 face=Arial>Just got the attached
request from someone implementing a decimal arithmetic library; I think it's a
C/C++ question really. But I'm not sure where to 'point him to'.
Any suggestions appreciated.</FONT><BR><FONT size=3
face=serif> </FONT><BR><FONT color=#0000ff size=2
face=Arial>Mike</FONT><BR><FONT size=3 face=serif> </FONT><BR><FONT
color=#008080 size=2 face=Arial>The C++ decimal FP TR defines, well,
everything, in terms of IEEE-754.<BR>Also operations like this: lhs == rhs
where lhs or rhs are integers or binary FP types. I am trying to
interpret IEEE-754 to see if it indeed defines such operations. (With a
quick look I could not find.)</FONT><BR><FONT size=3
face=serif> </FONT><BR><FONT color=#008080 size=2 face=Arial>I have no
problem defining the return value, however I am not sure if and what
exceptions are to be raised? For example, if I compare a<BR>decimal32 to
a double, and the double is larger that dec32_max, should I set overflow?
(Because I have tried to convert the double to<BR>dec32.) Or
perhaps I should set inexact, because I have tried to convert the Dec32 to
double first, and it may not be exactly representable?</FONT><BR><FONT size=3
face=serif> </FONT><BR><FONT color=#008080 size=2 face=Arial>Could you
give me a hint on what sections of the IEEE-754 I should read to find out
those things? Thanks in advance. Oh, and feel free to tell me if I
ask too much.</FONT><TT><FONT
size=2>_______________________________________________<BR>Cfp-interest mailing
list<BR>Cfp-interest@oakapple.net<BR></FONT></TT><TT><FONT size=2><A
href="http://mailman.oakapple.net/mailman/listinfo/cfp-interest">http://mailman.oakapple.net/mailman/listinfo/cfp-interest</A></FONT></TT><TT><FONT
size=2><BR></FONT></TT><BR><BR></BLOCKQUOTE></BODY></HTML>