<div dir="ltr">Pull requests are always welcome :-)</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, May 13, 2013 at 7:16 AM, Markus Schaber <span dir="ltr"><<a href="mailto:m.schaber@codesys.com" target="_blank">m.schaber@codesys.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Is anyone with commit access willing to commit the fix? And possibly include it in the upcoming 2.7.4? :-)<br>
<br>
Thanks :-)<br>
<br>
Best regards<br>
<br>
Markus Schaber<br>
<br>
CODESYS(r) a trademark of 3S-Smart Software Solutions GmbH<br>
<br>
Inspiring Automation Solutions<br>
<div class="im"><br>
3S-Smart Software Solutions GmbH<br>
Dipl.-Inf. Markus Schaber | Product Development Core Technology<br>
Memminger Str. 151 | 87439 Kempten | Germany<br>
Tel. <a href="tel:%2B49-831-54031-979" value="+4983154031979">+49-831-54031-979</a> | Fax <a href="tel:%2B49-831-54031-50" value="+498315403150">+49-831-54031-50</a><br>
<br>
</div>E-Mail: <a href="mailto:m.schaber@codesys.com">m.schaber@codesys.com</a> | Web: <a href="http://www.codesys.com" target="_blank">http://www.codesys.com</a> | CODESYS store: <a href="http://store.codesys.com" target="_blank">http://store.codesys.com</a><br>

CODESYS forum: <a href="http://forum.codesys.com" target="_blank">http://forum.codesys.com</a><br>
<div class="im"><br>
Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915<br>
</div>> Von: Jeff Hardy [mailto:<a href="mailto:jdhardy@gmail.com">jdhardy@gmail.com</a>]<br>
> Gesendet: Freitag, 10. Mai 2013 18:15<br>
> An: Markus Schaber<br>
> Cc: <a href="mailto:ironpython-users@python.org">ironpython-users@python.org</a><br>
<div class="im">> Betreff: Re: [Ironpython-users] IronPython float_info values (was:<br>
> IronPython always in 32-bit mode on 64bit machine even when running<br>
> ipy64.exe)<br>
><br>
</div><div><div class="h5">> For me, using BitConverter.IsLittleEndian is clearer:<br>
><br>
>   private static readonly double EPSILON =<br>
> System.BitConverter.Int64BitsToDouble(<br>
>     System.BitConverter.IsLittleEndian ? 0x3cb0000000000000 :<br>
> 0x000000000000b03c);<br>
><br>
>   private static readonly double MIN =<br>
> System.BitConverter.Int64BitsToDouble(<br>
>     System.BitConverter.IsLittleEndian ? 0x0010000000000000 :<br>
> 0x0000000000001000);<br>
><br>
> I don't think half-endian machines are worth worrying about. :)<br>
><br>
> - Jeff<br>
><br>
><br>
> On Fri, May 10, 2013 at 1:41 AM, Markus Schaber<br>
> <<a href="mailto:m.schaber@codesys.com">m.schaber@codesys.com</a>> wrote:<br>
> > Hi,<br>
> ><br>
> ><br>
> ><br>
> > Maybe we'd use some conditional initializiation, checking for the<br>
> > properties of the number, like the following:<br>
> ><br>
> ><br>
> ><br>
> >         // The definition of Epsion and MinValue differ<br>
> between .NET<br>
> > and Python/C,<br>
> ><br>
> >         // so we need to define our own values.<br>
> ><br>
> >         // Approx. -2.2204460492503131e-16 - the byte order<br>
> reversed<br>
> > value is approx.<br>
> ><br>
> >         // 2.2290265677773679e-319, so this code delivers the<br>
> correct<br>
> > value independently<br>
> ><br>
> >         // of the byte order of the machine.<br>
> ><br>
> >         private static readonly double EPSILON = Math.Max(<br>
> ><br>
> ><br>
> System.BitConverter.Int64BitsToDouble(0x3cb0000000000000),<br>
> ><br>
> ><br>
> > System.BitConverter.Int64BitsToDouble(0x000000000000b03c));<br>
> ><br>
> >         // Approx. 2.2250738585072014e-308 - the byte-order<br>
> reversed<br>
> > value is approx.<br>
> ><br>
> >         // 2.0236928853657458e-320, so this code delviers the<br>
> correct<br>
> > value independently<br>
> ><br>
> >         // of the byte order of the machine.<br>
> ><br>
> >         private static readonly double MIN = Math.Max(<br>
> ><br>
> ><br>
> System.BitConverter.Int64BitsToDouble(0x0010000000000000),<br>
> ><br>
> ><br>
> > System.BitConverter.Int64BitsToDouble(0x0000000000001000));<br>
> ><br>
> ><br>
> ><br>
> >         public static floatinfo float_info = new<br>
> > floatinfo(Double.MaxValue, 1024, 308, MIN, -1021, -307, 15, 53,<br>
> > EPSILON, 2, 1);<br>
> ><br>
> ><br>
> ><br>
> > This trick relies on the fact that for the given values, the<br>
> reversed<br>
> > byte order produces an zero-Exponent, which are denormalized<br>
> numbers,<br>
> > and in both cases, the wanted number is a normalized one which (by<br>
> > definition) is larger than the denormalized one.<br>
> ><br>
> ><br>
> ><br>
> > This code is as elegant as checking for the endianness explicitly,<br>
> and<br>
> > we are even safe for machines where the integer and float<br>
> endianness<br>
> > are different (see<br>
> > <a href="https://en.wikipedia.org/wiki/Endianness#Floating-" target="_blank">https://en.wikipedia.org/wiki/Endianness#Floating-</a><br>
> point_and_endianness<br>
</div></div>> > - although I doubt that those hardware is relevant for our user<br>
> base...)<br>
<div class="im">> > J<br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> > Best regards<br>
> ><br>
> > Markus Schaber<br>
> ><br>
</div>> > CODESYS(r) a trademark of 3S-Smart Software Solutions GmbH<br>
<div><div class="h5">> ><br>
> > Inspiring Automation Solutions<br>
> ><br>
> > ________________________________<br>
> ><br>
> > 3S-Smart Software Solutions GmbH<br>
> > Dipl.-Inf. Markus Schaber | Product Development Core Technology<br>
> > Memminger Str. 151 | 87439 Kempten | Germany Tel. <a href="tel:%2B49-831-54031-979" value="+4983154031979">+49-831-54031-979</a><br>
> |<br>
> > Fax <a href="tel:%2B49-831-54031-50" value="+498315403150">+49-831-54031-50</a><br>
> ><br>
> > E-Mail: <a href="mailto:m.schaber@codesys.com">m.schaber@codesys.com</a> | Web: <a href="http://codesys.com" target="_blank">codesys.com</a> | CODESYS store:<br>
> > <a href="http://store.codesys.com" target="_blank">store.codesys.com</a><br>
> > CODESYS forum: <a href="http://forum.codesys.com" target="_blank">forum.codesys.com</a><br>
> ><br>
> > Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner<br>
> |<br>
> > Trade<br>
> > register: Kempten HRB 6186 | Tax ID No.: DE 167014915<br>
> ><br>
> > Von: Slide [mailto:<a href="mailto:slide.o.mix@gmail.com">slide.o.mix@gmail.com</a>]<br>
> > Gesendet: Mittwoch, 8. Mai 2013 22:44<br>
> > An: Jeff Hardy<br>
> > Cc: Markus Schaber; Curt Hagenlocher; <a href="mailto:ironpython-users@python.org">ironpython-users@python.org</a><br>
> ><br>
> ><br>
> > Betreff: Re: [Ironpython-users] IronPython float_info values (was:<br>
> > IronPython always in 32-bit mode on 64bit machine even when running<br>
> > ipy64.exe)<br>
> ><br>
> ><br>
> ><br>
> > Unless Microsoft really wants pain and anguish, they are likely<br>
> > running in little endian mode. I've never run across an ARM setup<br>
> that<br>
> > actually runs in big endian (nor do I want to), so I'm pretty sure<br>
> its<br>
> > little endian. I'd be more than willing to test an app on my phone<br>
> > since Windows Phone is crap anyway, so you couldn't damage it any<br>
> > worse than it is now :-)<br>
> ><br>
> ><br>
> ><br>
> > Alex<br>
> ><br>
> ><br>
> ><br>
> > On Wed, May 8, 2013 at 12:54 PM, Jeff Hardy <<a href="mailto:jdhardy@gmail.com">jdhardy@gmail.com</a>><br>
> wrote:<br>
> ><br>
> > On Wed, May 8, 2013 at 9:15 AM, Markus Schaber<br>
> <<a href="mailto:m.schaber@codesys.com">m.schaber@codesys.com</a>><br>
> > wrote:<br>
> >> Hi,<br>
> >><br>
> >><br>
> >><br>
> ><br>
> >> The main problem for now is that I can't test whatever solution we<br>
> >> find, because I don't have access to any hardware with non-intel<br>
> Byte<br>
> >> Order and a Microsoft .NET. (I don't want to rely on Mono for this<br>
</div></div>> >> test...)<br>
<div class="HOEnZb"><div class="h5">> ><br>
> > Is ARM big-endian? If so, any Windows 8 ARM tablet (i.e. Surface RT)<br>
> > or Windows Phone should do. Heck, even the emulator might do. It<br>
> > shouldn't be too hard to whip up an app that prints those two<br>
> values,<br>
> > and I think Alex has a Windows Phone if he'd be willing to test it.<br>
> ><br>
> > If ARM is little-endian (or Windows/ARM runs in little-endian mode)<br>
> > then I don't think it matters; we'd have to try Mono on a PowerPC<br>
> or<br>
> > something like that.<br>
> ><br>
> > - Jeff<br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> > --<br>
> > Website: <a href="http://earl-of-code.com" target="_blank">http://earl-of-code.com</a><br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > Ironpython-users mailing list<br>
> > <a href="mailto:Ironpython-users@python.org">Ironpython-users@python.org</a><br>
> > <a href="http://mail.python.org/mailman/listinfo/ironpython-users" target="_blank">http://mail.python.org/mailman/listinfo/ironpython-users</a><br>
> ><br>
_______________________________________________<br>
Ironpython-users mailing list<br>
<a href="mailto:Ironpython-users@python.org">Ironpython-users@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/ironpython-users" target="_blank">http://mail.python.org/mailman/listinfo/ironpython-users</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Website: <a href="http://earl-of-code.com" target="_blank">http://earl-of-code.com</a>
</div>