Protect agains infinite loop when plotting tiny ranges#130
Protect agains infinite loop when plotting tiny ranges#130ghorn wants to merge 1 commit intotimbod7:masterfrom
Conversation
| range _ | minV == maxV = if minV==0 then (-1,1) else | ||
| let d = abs (minV * 0.01) in (minV-d,maxV+d) | ||
| let d = max 1e-300 (abs (minV * 0.01)) in (minV-d,maxV+d) | ||
| | otherwise = rs |
There was a problem hiding this comment.
I'm not actually sure if this is the correct behavior. It seems to give me a range of (-1e-300, 1e-300) when rs = (0, 0) and the freeze came back. Could you check it for me?
There was a problem hiding this comment.
I think 1e-300 is bad choice. Smallest normalized number 2.2250738585072014e-308 is 8 orders of magnitude away and underflow doesn't happen even for 1e-321. It's probably better to check whether maxV+d and minV-d are equal to maxV/minV.
range _ | minV == maxV = case minV of
0 -> (-1,1)
_ | lo /= minV && hi /= maxV -> (lo,hi)
| otherwise -> (minV/2,maxV*2)
| otherwise = rs
d = abs (minV * 0.01)
lo = minV - d
hi = maxV + d
|
I've pushed a fix to avoid the freeze in this commit: f27955b The issue is that this expression: will eat all RAM in bigint calculations when delta = 0 |
|
This doesn't guarantee you'll get sensible charts with tiny values - your patch may still be necessary for this. Test it and if it is necessary, I will merge. |
simple fix for #128