<?xml version="1.0" encoding="windows-1252"?>
<node id="781386" title="Re^2: [Win32, C, and way OT] C floats, doubles, and their equivalence" created="2009-07-18 20:12:45" updated="2009-07-18 20:12:45">
<type id="11">
note</type>
<author id="524150">
syphilis</author>
<data>
<field name="doctext">
&lt;i&gt;It's a stab in the dark ... &lt;/i&gt;&lt;br&gt;&lt;br&gt;Good stab - I can make use of that. The following outputs "True False" on the buggy compilers (and "True True" on sane compilers):
&lt;c&gt;
#include &lt;stdio.h&gt;

int main(void) {

   double nv = 2.0 / 3;
   float foo = 2.0 / 3;
   float truncated = (float)nv;

   if(foo == truncated) printf("True ");
   else printf("False ");

   if(foo == (float)nv) printf("True\n");
   else printf("False\n");

   return 0;
}

&lt;/c&gt;
I can apply that method (used to obtain that "True") to PDL, which solves the problem I have asked about. Unfortunately, while it enables me to get the behaviour I want with my C demo scripts, it's still not producing the correct result with PDL - but this is such a fickle bug. I'll have to play around with it some more. &lt;br&gt;&lt;br&gt;&lt;i&gt;PS: This is relevant to the work I do ensuring Windows compatibility for my XS distros&lt;/i&gt;&lt;br&gt;&lt;br&gt;&lt;c&gt;#if defined _MSC_VER &amp;&amp; _MSC_VER &lt; 1400&lt;/c&gt; then expect weirdness if you start comparing floats with doubles.&lt;br&gt;&lt;br&gt;Thanks Marvin.&lt;br&gt;&lt;br&gt;Cheers,&lt;br&gt;Rob</field>
<field name="root_node">
781347</field>
<field name="parent_node">
781353</field>
</data>
</node>
