
-------------------------------------------- -- logfloat 0.12.0.1 -------------------------------------------- This package provides a type for storing numbers in the log-domain, primarily useful for preventing underflow when multiplying many probabilities as in HMMs and other probabilistic models. The package also provides modules for dealing with floating numbers correctly. -------------------------------------------- -- Now using FFI -------------------------------------------- We now use the FFI to gain access to C's accurate log1p (and expm1) functions. This greatly increases the range of resolution, especially for very small LogFloat values. These are currently exposed from Data.Number.LogFloat, though they may move to a different module in future versions. On GHC 6.10 the use of -fvia-C had to be disabled because it conflicts with the FFI (version 0.12.0.0 still used it, which is fine on GHC 6.8). I'm still investigating the use of -fasm and getting proper benchmarking numbers. Contact me if you notice significant performance degradation. Using the FFI complicates the build process for Hugs; details are noted in the INSTALL file. It may also complicate building on Windows (due to ccall vs stdcall), though I'm not familiar with Windows FFI and don't have a machine to test on. The calling convention is "unsafe" in order to avoid overhead. However, in the past this has been noted to cause issues with multithreaded applications since it locks all RTS threads instead of just the calling thread. If you're using logfloat in a multithreaded application and notice a slowdown, or if you're more familiar with these details than I, tell me so I can fix things. If you have any difficulties with the FFI, let me know. As an interim solution the FFI can be disabled by turning off the useFFI Cabal flag during configure, which will compile the package to use the naive log1p implementation from earlier versions. -------------------------------------------- -- Other changes since 0.11.0 -------------------------------------------- * (0.11.1) Felipe Lessa added an instance for IArray UArray LogFloat. On GHC we use newtype deriving; On Hugs we fall back to unsafeCoerce to distribute the newtype over IArray UArray Double. * (0.11.2 Darcs) Moved the log/exp fusion rules from Data.Number.LogFloat into Data.Number.Transfinite where our log function is defined. * Added a Storable LogFloat instance for GHC. No implementation is available yet for Hugs. * Removed orphaned toRational/fromRational fusion rules, which were obviated by the introduction of the Data.Number.RealToFrac module in 0.11.0. * Changed the Real LogFloat instance to throw errors when trying to convert transfinite values into Rational. -------------------------------------------- -- Compatibility / Portability -------------------------------------------- The package is compatible with Hugs (September 2006) and GHC (6.8, 6.10). For anyone still using GHC 6.6, the code may still work if you replace LANGUAGE pragma by equivalent OPTIONS_GHC pragma. The package is not compatible with nhc98 and Yhc because Data.Number.RealToFrac uses MPTCs. The other modules should be compatible. -------------------------------------------- -- Links -------------------------------------------- Homepage: http://code.haskell.org/~wren/ Hackage: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/logfloat Darcs: http://code.haskell.org/~wren/logfloat/ Haddock (Darcs version): http://code.haskell.org/~wren/logfloat/dist/doc/html/logfloat/ -- Live well, ~wren

wren ng thornton wrote:
Using the FFI complicates the build process for Hugs; details are noted in the INSTALL file. It may also complicate building on Windows (due to ccall vs stdcall), > though I'm not familiar with Windows FFI and don't have a machine to test on.
On XP with GHC 6.10.1 it installed cleanly and easily via cabal-install (and a test program comparing results of (log . (1+)) v. log1p) showed that it worked properly).

Hello wren, Saturday, April 4, 2009, 2:51:39 AM, you wrote:
On GHC 6.10 the use of -fvia-C had to be disabled because it conflicts with the FFI (version 0.12.0.0 still used it, which is fine on GHC 6.8). I'm still investigating the use of -fasm and getting proper benchmarking numbers. Contact me if you notice significant performance degradation.
isn't this the same bug as in recent thread "[Haskell-cafe] Possible floating point bug in GHC?" ? -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

Indeed. I recommend upgrading to GHC 6.10.2, all the weird floating point
FFI bugs I encountered with GHC 6.10.1 seem to be resolved now.
On Sat, Apr 4, 2009 at 12:10 PM, Bulat Ziganshin
Hello wren,
Saturday, April 4, 2009, 2:51:39 AM, you wrote:
On GHC 6.10 the use of -fvia-C had to be disabled because it conflicts with the FFI (version 0.12.0.0 still used it, which is fine on GHC 6.8). I'm still investigating the use of -fasm and getting proper benchmarking numbers. Contact me if you notice significant performance degradation.
isn't this the same bug as in recent thread "[Haskell-cafe] Possible floating point bug in GHC?" ?
-- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Indeed. I recommend upgrading to GHC 6.10.2, all the weird floating point
FFI bugs I encountered with GHC 6.10.1 seem to be resolved now.
On Sat, Apr 4, 2009 at 12:10 PM, Bulat Ziganshin
Hello wren,
Saturday, April 4, 2009, 2:51:39 AM, you wrote:
On GHC 6.10 the use of -fvia-C had to be disabled because it conflicts with the FFI (version 0.12.0.0 still used it, which is fine on GHC 6.8). I'm still investigating the use of -fasm and getting proper benchmarking numbers. Contact me if you notice significant performance degradation.
isn't this the same bug as in recent thread "[Haskell-cafe] Possible floating point bug in GHC?" ?
-- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Indeed. I recommend upgrading to GHC 6.10.2, all the weird floating point
FFI bugs I encountered with GHC 6.10.1 seem to be resolved now.
On Sat, Apr 4, 2009 at 12:10 PM, Bulat Ziganshin
Hello wren,
Saturday, April 4, 2009, 2:51:39 AM, you wrote:
On GHC 6.10 the use of -fvia-C had to be disabled because it conflicts with the FFI (version 0.12.0.0 still used it, which is fine on GHC 6.8). I'm still investigating the use of -fasm and getting proper benchmarking numbers. Contact me if you notice significant performance degradation.
isn't this the same bug as in recent thread "[Haskell-cafe] Possible floating point bug in GHC?" ?
-- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (4)
-
Bulat Ziganshin
-
Peter Verswyvelen
-
Robert Greayer
-
wren ng thornton