Haskell: Force floats to have two decimals

前端 未结 2 1199
情深已故
情深已故 2020-12-29 02:46

Using the following code snippet:

(fromIntegral 100)/10.00

Using the Haskell \'98 standard prelude, how do I represent the result with two

2条回答
  •  既然无缘
    2020-12-29 03:09

    Just for the record:

    import Numeric 
    formatFloatN floatNum numOfDecimals = showFFloat (Just numOfDecimals) floatNum ""
    

提交回复
热议问题