Hi, The main problem for now is that I can't test whatever solution we find, because I don't have access to any hardware with non-intel Byte Order and a Microsoft .NET. (I don't want to rely on Mono for this test...)
Best regards Markus Schaber CODESYS(r) a trademark of 3S-Smart Software Solutions GmbH Inspiring Automation Solutions ________________________________ 3S-Smart Software Solutions GmbH Dipl.-Inf. Markus Schaber | Product Development Core Technology Memminger Str. 151 | 87439 Kempten | Germany Tel. +49-831-54031-979 | Fax +49-831-54031-50 E-Mail: [email protected]<mailto:[email protected]> | Web: codesys.com<http://www.codesys.com> | CODESYS store: store.codesys.com<http://store.codesys.com> CODESYS forum: forum.codesys.com<http://forum.codesys.com> Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 Von: Curt Hagenlocher [mailto:[email protected]] Gesendet: Mittwoch, 8. Mai 2013 18:09 An: Markus Schaber Cc: Jeff Hardy; [email protected] Betreff: Re: [Ironpython-users] IronPython float_info values (was: IronPython always in 32-bit mode on 64bit machine even when running ipy64.exe) You may be able to avoid endian-ness issues by using BitConverter.ToDouble with a byte array instead. (I'm never sure how endian-ness and IEEE-754 interact.) On Wed, May 8, 2013 at 9:06 AM, Markus Schaber <[email protected]<mailto:[email protected]>> wrote: Hi, I tried to find a way to calculate it reliably, but did not find an easy, nice and fast way. I guess setting the IEC bits directly is the best way for now, together with a comment why we don't use the false friends provided by .NET. However, as far as I read the docs of DoubleToInt64Bits() and Int64BitsToDouble(), the conversion may be subject to endianess issues... Best regards Markus Schaber CODESYS(r) a trademark of 3S-Smart Software Solutions GmbH Inspiring Automation Solutions ________________________________ 3S-Smart Software Solutions GmbH Dipl.-Inf. Markus Schaber | Product Development Core Technology Memminger Str. 151 | 87439 Kempten | Germany Tel. +49-831-54031-979<tel:%2B49-831-54031-979> | Fax +49-831-54031-50<tel:%2B49-831-54031-50> E-Mail: [email protected]<mailto:[email protected]> | Web: codesys.com<http://www.codesys.com> | CODESYS store: store.codesys.com<http://store.codesys.com> CODESYS forum: forum.codesys.com<http://forum.codesys.com> Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 Von: Curt Hagenlocher [mailto:[email protected]<mailto:[email protected]>] Gesendet: Mittwoch, 8. Mai 2013 17:34 An: Jeff Hardy Cc: Markus Schaber; [email protected]<mailto:[email protected]> Betreff: Re: [Ironpython-users] IronPython float_info values (was: IronPython always in 32-bit mode on 64bit machine even when running ipy64.exe) You can get precise values of these without depending on the compiler's ability to convert text to floating point values by saying sys.float_info.min = System.BitConverter.Int64BitsToDouble(0x0010000000000000) # i.e. 2^-1023 sys.float_info.epsilon = System.BitConverter.Int64BitsToDouble(0x3cb0000000000000) # i.e. 2^-53 On Wed, May 8, 2013 at 8:10 AM, Jeff Hardy <[email protected]<mailto:[email protected]>> wrote: On Wed, May 8, 2013 at 4:07 AM, Markus Schaber <[email protected]<mailto:[email protected]>> wrote: Hi, http://www.johndcook.com/blog/2010/06/08/c-math-gotchas/ explains the problem: The double.MinValue and double.Epsilon in C# have different meanings thant DBL_MIN and DBL_EPSILON in C. I'm looking for a way how to get the wanted values... :) So am I! .NET does not provide them as constants as far as I can tell. I'm pretty sure .NET requires the use of IEEE-854 floats so they could probably just be hardcoded to match the C constants but ... ick. Maybe there's a way to calculate the C versions from what .NET provides? The relevant issue is https://ironpython.codeplex.com/workitem/27840. - Jeff _______________________________________________ Ironpython-users mailing list [email protected]<mailto:[email protected]> http://mail.python.org/mailman/listinfo/ironpython-users
_______________________________________________ Ironpython-users mailing list [email protected] http://mail.python.org/mailman/listinfo/ironpython-users
