本文介绍了Haskell中的负双打或浮动(macports)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 为什么当我尝试显示负双或浮动时出现分段错误?负数整数没有问题。 Prelude>让a = 4 Prelude> :t a a ::整数前奏>让b = -4 前奏> b -4 前奏> :t b b :: Integer Prelude>让c = 5.6 Prelude> :t c c :: Double Prelude>让d = -5.6 前奏> :t d d :: Double Prelude>显示d - 分段错误 我尝试过不同的方法,版本信息: ghci --version Glorious Glasgow Haskell编译系统,版本6.10.4 解决方案 MacPorts上的GHC似乎被打破。请参阅 https://trac.macports.org/ticket/25265 请考虑从haskell.org安装Haskell Platform,其中包含GHC 6.12.3和一束Haskelly的好东西。 信息: http://hackage.haskell.org/platform/ 链接: http://hackage.haskell.org/platform/mac.html ul> Why do I get a segmentation fault when I try to show a negative double or float? There is no problem for negative integers.Prelude> let a = 4Prelude> :t aa :: IntegerPrelude> let b = -4Prelude> b-4Prelude> :t bb :: IntegerPrelude> let c = 5.6Prelude> :t cc :: DoublePrelude> let d = -5.6Prelude> :t dd :: DoublePrelude> show d"-Segmentation faultI tried it various ways, it seems that the number is correctly understood but not shown. Version info:ghci --versionThe Glorious Glasgow Haskell Compilation System, version 6.10.4 解决方案 GHC on MacPorts seems to be broken. See https://trac.macports.org/ticket/25265Consider instead installing the Haskell Platform from haskell.org, which includes GHC 6.12.3 and a bundle of Haskelly goodies.Info: http://hackage.haskell.org/platform/Link: http://hackage.haskell.org/platform/mac.html 这篇关于Haskell中的负双打或浮动(macports)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-21 03:54