Directed rounding in haskell ?

Hello list, I'm going to implement an interval arithmetic library (following the IEEE P1788) in Haskell and for that I need support for directed rounding to the nearest floating point number. I had a quick look at the Decimal package which comes with the `roundTo` function for rounding to a specified number of decimal places but it doesn't provide directed rounding. Is there way to get directed rounding to to the nearest float (maybe even with machine floats) ? I'm also aware of the AERN-* packages but they seem to be unmaintained. At least there is no version which builds with the current GHC. Does anybody know something about that ? Regards dominik

You can set the rounding mode directly with ieee-utils. Apparently it doesn't compile anymore, so someone has uploaded a temporary replacement: http://hackage.haskell.org/package/ieee-utils-tempfix-0.4.0.1 The primary maintainer of the original package left the haskell community some time ago. (I contributed some additional code many years ago). Michal Konecny -- would you be interested in taking over maintainership? -s On 4/7/14, 10:12 AM, Dominik Peteler wrote:
Hello list,
I'm going to implement an interval arithmetic library (following the IEEE P1788) in Haskell and for that I need support for directed rounding to the nearest floating point number. I had a quick look at the Decimal package which comes with the `roundTo` function for rounding to a specified number of decimal places but it doesn't provide directed rounding. Is there way to get directed rounding to to the nearest float (maybe even with machine floats) ?
I'm also aware of the AERN-* packages but they seem to be unmaintained. At least there is no version which builds with the current GHC. Does anybody know something about that ?
Regards
dominik
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

if you ask for taking over maintainership on the libraries list, I can give
you uploader acls
On Mon, Apr 7, 2014 at 9:07 PM, Sterling Clover
You can set the rounding mode directly with ieee-utils.
Apparently it doesn't compile anymore, so someone has uploaded a temporary replacement: http://hackage.haskell.org/package/ieee-utils-tempfix-0.4.0.1
The primary maintainer of the original package left the haskell community some time ago. (I contributed some additional code many years ago). Michal Konecny -- would you be interested in taking over maintainership?
-s
On 4/7/14, 10:12 AM, Dominik Peteler wrote:
Hello list,
I'm going to implement an interval arithmetic library (following the IEEE P1788) in Haskell and for that I need support for directed rounding to the nearest floating point number. I had a quick look at the Decimal package which comes with the `roundTo` function for rounding to a specified number of decimal places but it doesn't provide directed rounding. Is there way to get directed rounding to to the nearest float (maybe even with machine floats) ?
I'm also aware of the AERN-* packages but they seem to be unmaintained. At least there is no version which builds with the current GHC. Does anybody know something about that ?
Regards
dominik
_______________________________________________ Haskell-Cafe mailing listHaskell-Cafe@haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Thank you for your response. I had a quick look at it but I'll probably go with some MPFR binding first. Maybe I'll add support for it later. Regards Dominik On Mon 2014-04-07 21:07, Sterling Clover wrote:
You can set the rounding mode directly with ieee-utils.
Apparently it doesn't compile anymore, so someone has uploaded a temporary replacement: http://hackage.haskell.org/package/ieee-utils-tempfix-0.4.0.1
The primary maintainer of the original package left the haskell community some time ago. (I contributed some additional code many years ago). Michal Konecny -- would you be interested in taking over maintainership?
-s
On 4/7/14, 10:12 AM, Dominik Peteler wrote:
Hello list,
I'm going to implement an interval arithmetic library (following the IEEE P1788) in Haskell and for that I need support for directed rounding to the nearest floating point number. I had a quick look at the Decimal package which comes with the `roundTo` function for rounding to a specified number of decimal places but it doesn't provide directed rounding. Is there way to get directed rounding to to the nearest float (maybe even with machine floats) ?
I'm also aware of the AERN-* packages but they seem to be unmaintained. At least there is no version which builds with the current GHC. Does anybody know something about that ?
Regards
dominik
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Maybe these packages could be relevant/useful:
- https://github.com/ekmett/rounded
- https://github.com/ekmett/intervals
On Mon, Apr 7, 2014 at 4:12 PM, Dominik Peteler
Hello list,
I'm going to implement an interval arithmetic library (following the IEEE P1788) in Haskell and for that I need support for directed rounding to the nearest floating point number. I had a quick look at the Decimal package which comes with the `roundTo` function for rounding to a specified number of decimal places but it doesn't provide directed rounding. Is there way to get directed rounding to to the nearest float (maybe even with machine floats) ?
I'm also aware of the AERN-* packages but they seem to be unmaintained. At least there is no version which builds with the current GHC. Does anybody know something about that ?
Regards
dominik
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Alp Mestanogullari

It might also be worthwhile to have a look at some
prior art:
http://hackage.haskell.org/package/Ranged-sets
On Thu, Apr 10, 2014 at 5:15 PM, Alp Mestanogullari
Maybe these packages could be relevant/useful: - https://github.com/ekmett/rounded - https://github.com/ekmett/intervals
On Mon, Apr 7, 2014 at 4:12 PM, Dominik Peteler
wrote: Hello list,
I'm going to implement an interval arithmetic library (following the IEEE P1788) in Haskell and for that I need support for directed rounding to the nearest floating point number. I had a quick look at the Decimal package which comes with the `roundTo` function for rounding to a specified number of decimal places but it doesn't provide directed rounding. Is there way to get directed rounding to to the nearest float (maybe even with machine floats) ?
I'm also aware of the AERN-* packages but they seem to be unmaintained. At least there is no version which builds with the current GHC. Does anybody know something about that ?
Regards
dominik
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Alp Mestanogullari
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Thu 2014-04-10 16:15, Alp Mestanogullari wrote:
Maybe these packages could be relevant/useful: - https://github.com/ekmett/rounded
Very interesting, thank you. How does it compare to hmpfr[1] ? Regards Dominik [1] http://hackage.haskell.org/package/hmpfr
- https://github.com/ekmett/intervals
On Mon, Apr 7, 2014 at 4:12 PM, Dominik Peteler
wrote: Hello list,
I'm going to implement an interval arithmetic library (following the IEEE P1788) in Haskell and for that I need support for directed rounding to the nearest floating point number. I had a quick look at the Decimal package which comes with the `roundTo` function for rounding to a specified number of decimal places but it doesn't provide directed rounding. Is there way to get directed rounding to to the nearest float (maybe even with machine floats) ?
I'm also aware of the AERN-* packages but they seem to be unmaintained. At least there is no version which builds with the current GHC. Does anybody know something about that ?
Regards
dominik
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Alp Mestanogullari

On 11/04/14 12:16, Dominik Peteler wrote:
On Thu 2014-04-10 16:15, Alp Mestanogullari wrote:
Maybe these packages could be relevant/useful: - https://github.com/ekmett/rounded
Very interesting, thank you. How does it compare to hmpfr[1] ?
'hmpfr' doesn't work safely (random crashes occur) unless you re-compile a custom ghc without 'integer-gmp', and the alternative 'integer-simple' is very slow in comparison. 'rounded' works around the problem (GHC's GC moving GMP things behind MPFR's back) but requires a patched libmpfr (which it bundles), though it is still not quite ready for general use (a few remaining issues to resolve afaik). Claude -- http://mathr.co.uk

Thank you for the explanation. Apparently there is no package on hackage (yet). (At least the link on the github page is dead) When is it going to be released ? Regards Dominik On Fri 2014-04-11 13:03, Claude Heiland-Allen wrote:
On 11/04/14 12:16, Dominik Peteler wrote:
On Thu 2014-04-10 16:15, Alp Mestanogullari wrote:
Maybe these packages could be relevant/useful: - https://github.com/ekmett/rounded
Very interesting, thank you. How does it compare to hmpfr[1] ?
'hmpfr' doesn't work safely (random crashes occur) unless you re-compile a custom ghc without 'integer-gmp', and the alternative 'integer-simple' is very slow in comparison.
'rounded' works around the problem (GHC's GC moving GMP things behind MPFR's back) but requires a patched libmpfr (which it bundles), though it is still not quite ready for general use (a few remaining issues to resolve afaik).
Claude -- http://mathr.co.uk
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

When it's ready.
On Friday, April 11, 2014, Dominik Peteler
Thank you for the explanation. Apparently there is no package on hackage (yet). (At least the link on the github page is dead) When is it going to be released ?
Regards
Dominik
On Fri 2014-04-11 13:03, Claude Heiland-Allen wrote:
On 11/04/14 12:16, Dominik Peteler wrote:
On Thu 2014-04-10 16:15, Alp Mestanogullari wrote:
Maybe these packages could be relevant/useful: - https://github.com/ekmett/rounded
Very interesting, thank you. How does it compare to hmpfr[1] ?
'hmpfr' doesn't work safely (random crashes occur) unless you re-compile a custom ghc without 'integer-gmp', and the alternative 'integer-simple' is very slow in comparison.
'rounded' works around the problem (GHC's GC moving GMP things behind MPFR's back) but requires a patched libmpfr (which it bundles), though it is still not quite ready for general use (a few remaining issues to resolve afaik).
Claude -- http://mathr.co.uk
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org javascript:; http://www.haskell.org/mailman/listinfo/haskell-cafe

On 11/04/2014, at 2:15 AM, Alp Mestanogullari wrote:
Maybe these packages could be relevant/useful: - https://github.com/ekmett/rounded - https://github.com/ekmett/intervals
The latter of these has a rich interface, but I a b + I a' b' = (a + a') ... (b + b') _ + _ = Empty (Numeric.Interval.Internal.hs) does not do the necessary directed rounding. The package looks like an excellent way to deal with intervals of exact numbers, but for floating point numbers it's not at all what one usually intends.
participants (7)
-
Alp Mestanogullari
-
Carter Schonwald
-
Claude Heiland-Allen
-
Dominik Peteler
-
Richard A. O'Keefe
-
Sterling Clover
-
Yitzchak Gale