Free42 with IEEE 754-2008 decimal floating-point -- interested in a sneak preview? - Printable Version +- HP Forums ( https://www.hpmuseum.org/forum)+-- Forum: Not HP Calculators ( /forum-7.html)+--- Forum: Not quite HP Calculators - but related ( /forum-8.html)+--- Thread: Free42 with IEEE 754-2008 decimal floating-point -- interested in a sneak preview? ( /thread-756.html) |

Free42 with IEEE 754-2008 decimal floating-point -- interested in a sneak preview? - Thomas Okken - 02-24-2014 12:09 AM
Hi all, I'm working on replacing the BCD20 floating-point library in Free42 Decimal with the Intel Decimal Floating-Point Math Library. Link: http://software.intel.com/en-us/articles/intel-decimal-floating-point-math-library Link to Free42 for those who don't know what I'm talking about: http://thomasokken.com/free42/ I currently have this running on 32-bit and 64-bit Linux, and expect to have it working for Windows and OS X next weekend (March 1 or 2), if not sooner. Android will follow soon after; iOS will take a bit longer because I have to make some non-floating-point-related changes to add proper support for the iPhone 5's larger screen, since Apple will no longer accept apps without such support. The new floating-point library has a slightly smaller dynamic range than BCD20 (exponents between a little under -6000 and a little over +6000, as opposed to -10000 through +9999), but it has 34-digit precision, up from 25 in BCD20, and it supports denormal numbers and unbiased rounding. I haven't done any performance tests yet, but I expect the new library to be faster, since it stores numbers in a more efficient format. If anyone is interested in playing with this before the official release, drop me a line and I'll send you the 32-bit and/or 64-bit Linux build, or any of the others as soon as I am able to build them -- or the source code, for anyone who would like to take a swing at building it themselves. Cheers! - Thomas RE: Free42 with IEEE 754-2008 decimal floating-point -- interested in a sneak preview? - Paul Dale - 02-24-2014 01:47 AM
Nice work. Just out of interest, what do you use for the mathematical functions? I know you had you own implementations of many but I don't know how well they'd have come forward to the wider floats. - Pauli RE: Free42 with IEEE 754-2008 decimal floating-point - interested in a sneak preview? - Thomas Okken - 02-24-2014 02:33 AM
(02-24-2014 01:47 AM)Paul Dale Wrote: Nice work. Just out of interest, what do you use for the mathematical functions? The Intel library provides all the functions Free42 needs; it doesn't just have arithmetic and square root, but also trigonometrics, hyperbolics, logarithms, and gamma. The new code uses all of these wherever possible, using the highest-precision format, decimal128. The higher-level functionality, like complex numbers, matrices, numerical integration, and numerical root-finding, is still done using the same algorithms and code as before, but everything now uses the new library for the basic operations underneath. In Free42 1.4, the first release that supported decimal floating-point, I basically replaced all occurrences of the C/C++ "double" type with "phloat" (silly, I know), which, in the binary builds, is #defined as "double", and in the decimal builds, is #defined as "Phloat" (note the capital P), which in turn is a C++ class that implements all the necessary constructors, assignment operators, and other operators and friend functions, so that it can be used as a drop-in replacement for plain "double". All the BCD20 stuff was abstracted away by the Phloat class, and the new Free42 code basically just has a new Phloat that uses the Intel library underneath. There have been some changes to the binary/decimal conversion and display code, but that's about it. - Thomas RE: Free42 with IEEE 754-2008 decimal floating-point -- interested in a sneak preview? - Werner - 02-24-2014 06:45 AM
I can hardly wait! For the Windows and iOS versions ;-) Werner RE: Free42 with IEEE 754-2008 decimal floating-point -- interested in a sneak preview - walter b - 02-24-2014 06:55 AM
I'm interested in the Windows version. There's some free test capacity as long as day X hasn't come yet. d:-) RE: Free42 with IEEE 754-2008 decimal floating-point - interested in a sneak preview? - Thomas Okken - 02-24-2014 12:51 PM
OK, I have put up the Linux builds. Link: http://thomasokken.com/free42/download/intel-decimal/ I will try to build the Windows version and upload it tonight, other versions to follow. I will post follow-ups to this thread as additional versions become available. - Thomas RE: Free42 with IEEE 754-2008 decimal floating-point -- interested in a sneak preview? - john jensen - 02-24-2014 06:44 PM
This is so nice, very nice work indeed RE: Free42 with IEEE 754-2008 decimal floating-point - Thomas Klemm - 02-24-2014 07:54 PM
(02-24-2014 12:09 AM)Thomas Okken Wrote: but it has 34-digit precisionIs there a place where you want us to report bugs? Example: 1E-34 1 + 1 - Result: 0.0000E-34 Expected: 0.0000 Thank you very much for your effort. Cheers Thomas Addendum: Free42 with IEEE 754-2008 decimal floating-point - Thomas Klemm - 02-24-2014 08:41 PM
Quote:Because the significand is not normalized, most values with less than 34 significant digits have multiple possible representations; 1×10Thus maybe not a bug. Still strange. I'd definitely recommend to normalize the results. RE: Free42 with IEEE 754-2008 decimal floating-point -- interested in a sneak preview? - Paul Dale - 02-24-2014 10:12 PM
I hit the non-unique representation problem in the 34S. I don't remember how I solved it for display any more. Multiple representations of zero caused other issues -- we couldn't just zero registers with a memory clear until after some code was added to detect this form of zero. In integer mode, a memory clear was the way to zero registers... - Pauli RE: Free42 with IEEE 754-2008 decimal floating-point - interested in a sneak preview? - Thomas Okken - 02-25-2014 12:10 AM
(02-24-2014 07:54 PM)Thomas Klemm Wrote: Is there a place where you want us to report bugs? You can use this thread, or the Free42 forum, or email me. Link to Free42 forum: http://groups.google.com/group/free42discuss My email: thomas_okken@yahoo.com (02-24-2014 07:54 PM)Thomas Klemm Wrote: 1E-34 This appears to be a quirk in the bid128_to_string() function in the Intel library. Numerically, there doesn't appear to be a problem: these zeroes with nonzero exponents do compare equal to regular zero and to each other. I added a couple of lines in the display code, to make it ignore the exponent when the mantissa is zero; the updated code is on my web site now, under the same URL as before. - Thomas RE: Free42 with IEEE 754-2008 decimal floating-point -- interested in a sneak preview? - Thomas Okken - 02-25-2014 12:19 AM
The Windows build is going to take a bit longer than I thought. The Intel code won't compile in Visual C++ 6.0, so I may have to go back to VC++ 2010 or 2012. That means more work for me, and possibly the end of XP support. Argh! More tomorrow... RE: Free42 with IEEE 754-2008 decimal floating-point -- interested in a sneak preview? - Massimo Gnerucci - 02-25-2014 07:31 AM
(02-25-2014 12:19 AM)Thomas Okken Wrote: and possibly the end of XP support. XP is doomed anyway: -42 and counting. :) RE: Free42 with IEEE 754-2008 decimal floating-point -- interested in a sneak preview? - Marcus von Cube - 02-25-2014 09:51 PM
(02-25-2014 12:19 AM)Thomas Okken Wrote: The Intel code won't compile in Visual C++ 6.0, so I may have to go back to VC++ 2010 or 2012. That means more work for me, and possibly the end of XP support.Don't worry, XP is no problem, at least with VC++ 2010. RE: Free42 with IEEE 754-2008 decimal floating-point - interested in a sneak preview? - Thomas Okken - 02-26-2014 12:22 AM
(02-25-2014 09:51 PM)Marcus von Cube Wrote:(02-25-2014 12:19 AM)Thomas Okken Wrote: The Intel code won't compile in Visual C++ 6.0, so I may have to go back to VC++ 2010 or 2012. That means more work for me, and possibly the end of XP support.Don't worry, XP is no problem, at least with VC++ 2010. That's good to know. I'll try that then; if it compiles the Intel code, I should be good to go. Thanks for the tip! RE: Free42 with IEEE 754-2008 decimal floating-point -- interested in a sneak preview? - Paul Dale - 02-26-2014 12:42 AM
I had a bit of a poke around the Intel Decimal Floating-Point Math Library last night hoping to find a faster implementation of logarithms for the 34S firmware. Lots of large tables and relatively straightforward functions. I suspect that this will be fast and large -- suitable for desktop PCs but not so good for handheld devices. Oh well. - Pauli RE: Free42 with IEEE 754-2008 decimal floating-point - interested in a sneak preview? - Thomas Okken - 02-26-2014 01:20 AM
(02-26-2014 12:42 AM)Paul Dale Wrote: I had a bit of a poke around the Intel Decimal Floating-Point Math Library last night hoping to find a faster implementation of logarithms for the 34S firmware. Lots of large tables and relatively straightforward functions. I suspect that this will be fast and large -- suitable for desktop PCs but not so good for handheld devices. Oh well. It's certainly a lot larger than BCD20. The Free42 executables are gaining a lot of weight! The Linux builds of the library for x86 and amd64 are around 6 megabytes; about 5.5 MB for amd64 and 7 MB for x86. I haven't tried building it for ARM yet, but I expect something close to that higher number. Not something I would have wanted to use on 68k Palm devices... but on iOS or Android smartphones, no problem. RE: Free42 with IEEE 754-2008 decimal floating-point -- interested in a sneak preview? - Paul Dale - 02-26-2014 04:18 AM
The code didn't seem to support ARM out of the box. I couldn't be bothered added the defines to make it do so. It will be quite a bit larger on ARM than x86 and probably a bit larger even using THUMB (which the 34S does). Better increase the flash size on the 43S so it will fit - Pauli RE: Free42 with IEEE 754-2008 decimal floating-point -- interested in a sneak preview? - Paul Dale - 02-26-2014 10:15 AM
Poking around some more and this decimal maths library requires a large amount of binary support too -- supporting both probably wouldn't include much, if any, extra library code. - Pauli RE: Free42 with IEEE 754-2008 decimal floating-point - interested in a sneak preview? - Thomas Okken - 03-01-2014 09:14 PM
I uploaded the Windows build. I used VC++ 2008 to compile the Intel library and Free42 proper. I have only tested this on Windows 7, but I assume it will work in XP, too, though maybe that will require bundling the VC++ 2008 runtime. Since this thread is now on its second page, here's the download link again: http://thomasokken.com/free42/download/intel-decimal/ |