Re: [GHC] #4383: Uncanonical display of Double

2010-12-10 Thread GHC
#4383: Uncanonical display of Double
--+-
  Reporter:  daniel.is.fischer|  Owner:  
  Type:  bug  | Status:  closed  
  Priority:  high |  Milestone:  7.0.2   
 Component:  libraries/base   |Version:  6.12.3  
Resolution:  fixed|   Keywords:  Double, show
  Testcase:   |  Blockedby:  
Difficulty:   | Os:  Unknown/Multiple
  Blocking:   |   Architecture:  Unknown/Multiple
   Failure:  Incorrect result at runtime  |  
--+-
Changes (by igloo):

  * status:  merge = closed
  * resolution:  = fixed


Comment:

 Both merged.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4383#comment:6
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #4383: Uncanonical display of Double

2010-12-09 Thread GHC
#4383: Uncanonical display of Double
--+-
Reporter:  daniel.is.fischer  |Owner: 
Type:  bug|   Status:  merge  
Priority:  high   |Milestone:  7.0.2  
   Component:  libraries/base |  Version:  6.12.3 
Keywords:  Double, show   | Testcase: 
   Blockedby: |   Difficulty: 
  Os:  Unknown/Multiple   | Blocking: 
Architecture:  Unknown/Multiple   |  Failure:  Incorrect result at runtime
--+-
Changes (by simonmar):

  * status:  patch = merge


Comment:

 I pushed all these to HEAD.  We want these two in 7.0.2:

 {{{
 Sun Oct 24 11:29:42 PDT 2010  Daniel Fischer daniel.is.fisc...@web.de
   * FIX #4383
   Use a better approximation to logBase 10 2 to prevent leading zeros in
 floatToDigits.

 Sun Oct 24 19:50:41 BST 2010  Daniel Fischer daniel.is.fisc...@web.de
   * Fix typo in floatToDigits
   The mDn value for powers of 2 = floatDigits x - 1 was typo'ed, leading
 to longer than necessary show results in a few cases (e.g. 2.0^852).
   Corrected in accordance with Burger and Dybvig's paper.
 }}}

 and these two should stay in HEAD only:

 {{{
 Sun Oct 24 20:07:07 BST 2010  Daniel Fischer daniel.is.fisc...@web.de
   * Cache for powers of 10
   Add a cache for commonly needed powers of 10 to speed up floatToDigits.

 Sun Oct 24 19:59:14 BST 2010  Daniel Fischer daniel.is.fisc...@web.de
   * Performance enchancement for floatToDigits
   Use quot and quotRem instead of div and divMod for dividing positive
 Integers since that is a bit faster.
 }}}

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4383#comment:5
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #4383: Uncanonical display of Double

2010-11-01 Thread GHC
#4383: Uncanonical display of Double
--+-
Reporter:  daniel.is.fischer  |Owner: 
Type:  bug|   Status:  patch  
Priority:  high   |Milestone:  7.0.2  
   Component:  libraries/base |  Version:  6.12.3 
Keywords:  Double, show   | Testcase: 
   Blockedby: |   Difficulty: 
  Os:  Unknown/Multiple   | Blocking: 
Architecture:  Unknown/Multiple   |  Failure:  Incorrect result at runtime
--+-
Changes (by simonmar):

  * priority:  normal = high
  * milestone:  = 7.0.2


Comment:

 Thanks Daniel.

 I presume we want the fixes in the 7.0 branch and the performance
 improvements in 7.2.  Milestoning for 7.0.2 to get the fixes in initially.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4383#comment:4
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #4383: Uncanonical display of Double

2010-10-24 Thread GHC
#4383: Uncanonical display of Double
--+-
Reporter:  daniel.is.fischer  |   Owner: 
Type:  bug|  Status:  patch  
Priority:  normal |   Component:  libraries/base 
 Version:  6.12.3 |Keywords:  Double, show   
Testcase: |   Blockedby: 
  Os:  Unknown/Multiple   |Blocking: 
Architecture:  Unknown/Multiple   | Failure:  Incorrect result at runtime
--+-
Changes (by daniel.is.fischer):

  * status:  new = patch


Comment:

 1. fix4383.dpatch fixes the issue, we no longer overestimate the base 10
 logarithm
  2. There was a typo (b instead of be) in the distance to the next smaller
 FP number for powers of floatRadix. I thought it ought to be `b^e` and
 verified it in the paper. This makes numrun012 fail because now `2 ^ 31 ::
 Float` shows as 2.1474836e9 instead of 2.1474837e9 (and some other
 show values change too, e.g. `2.0 ^ 852` was 3.0030067315218801e256 is
 now 3.00300673152188e256).
  3. Performance enhancement by using quot/quotRem instead of div/divMod
 and using the cache of powers of 2 instead of recomputing.
  4. Further performance enhancement by adding a cache for powers of 10.
  5. All of the above in one patch.

 1. and 2. should be applied since they correct errors.[[BR]]
 The performance enhancement isn't too bad, I think a few more percent
 could be squeezed out, but it doesn't solve the fundamental problem of the
 slowness of show for !RealFloat values (cf.
 http://www.haskell.org/pipermail/haskell-cafe/2009-June/062904.html). I
 plan to look into it for 7.2, not now.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4383#comment:3
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #4383: Uncanonical display of Double

2010-10-22 Thread GHC
#4383: Uncanonical display of Double
--+-
Reporter:  daniel.is.fischer  |   Owner: 
Type:  bug|  Status:  new
Priority:  normal |   Component:  libraries/base 
 Version:  6.12.3 |Keywords:  Double, show   
Testcase: |   Blockedby: 
  Os:  Unknown/Multiple   |Blocking: 
Architecture:  Unknown/Multiple   | Failure:  Incorrect result at runtime
--+-

Comment(by daniel.is.fischer):

 For starters, a better approximation to logBase 10 2 fixes this,
 {{{
  if b == 2  base == 10 then
 -- logBase 10 2 is slightly bigger than 3/10 so
 -- the following will err on the low side.  Ignoring
 -- the fraction will make it err even more.
 -- Haskell promises that p-1 = logBase b f  p.
 -- (p - 1 + e0) * 3 `div` 10
 (p - 1 + e0) * 21306 `quot` 70777

 *FloatShow let x :: Double; x = 0.5 ^ 1030
 *FloatShow floatToDigits 10 x
 ([8,6,9,1,6,9,4,7,5,9,7,9,4],-310)
 *FloatShow showFloat x 
 8.691694759794e-311
 }}}
 but I'd rather check the code carefully to see whether something else
 might need fixing (and maybe an earlier convergent of logBase 10 2 will
 suffice).

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4383#comment:2
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[GHC] #4383: Uncanonical display of Double

2010-10-08 Thread GHC
#4383: Uncanonical display of Double
--+-
Reporter:  daniel.is.fischer  |   Owner: 
Type:  bug|  Status:  new
Priority:  normal |   Component:  libraries/base 
 Version:  6.12.3 |Keywords:  Double, show   
Testcase: |   Blockedby: 
  Os:  Unknown/Multiple   |Blocking: 
Architecture:  Unknown/Multiple   | Failure:  Incorrect result at runtime
--+-
 {{{
 Prelude 0.5 ^ 1030
 0.8691694759794e-310
 }}}
 Should of course be 8.69...e-311, just to have it on record for now.

 I'll take a look at the showing code one of the next days.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4383
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #4383: Uncanonical display of Double

2010-10-08 Thread GHC
#4383: Uncanonical display of Double
--+-
Reporter:  daniel.is.fischer  |   Owner: 
Type:  bug|  Status:  new
Priority:  normal |   Component:  libraries/base 
 Version:  6.12.3 |Keywords:  Double, show   
Testcase: |   Blockedby: 
  Os:  Unknown/Multiple   |Blocking: 
Architecture:  Unknown/Multiple   | Failure:  Incorrect result at runtime
--+-
Changes (by augustss):

 * cc: lenn...@… (added)


Comment:

 That code is pretty impenetrable. :)

 My guess is that the log estimator doesn't do the right thing for negative
 exponents.  Try (fixup (k0-1)).

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4383#comment:1
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs