fork download
  1. import Text.Printf
  2.  
  3. z x
  4. | x > 2 = tan ((x ^ 3 - 1) / 2) + sqrt x
  5. | 0 < x && x <= 2 = log (2 * x / 3) - sin (x / 2)
  6. | otherwise = exp (-x) + 2 * x ^ 2
  7.  
  8. znacheniya = zip xs $ map z xs where
  9. xs = [-3,-2.7 .. 4]
  10.  
  11.  
  12. napechatatStroku :: (Double, Double) -> IO ()
  13. napechatatStroku (x, z) = printf "% 5.4f | % 5.4f\n" x z
  14.  
  15. napechatatTablicoi = mapM_ napechatatStroku
  16.  
  17. main = napechatatTablicoi znacheniya
Success #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
-3.0000 |  38.0855
-2.7000 |  29.4597
-2.4000 |  22.5432
-2.1000 |  16.9862
-1.8000 |  12.5296
-1.5000 |  8.9817
-1.2000 |  6.2001
-0.9000 |  4.0796
-0.6000 |  2.5421
-0.3000 |  1.5299
-0.0000 |  1.0000
 0.3000 | -1.7589
 0.6000 | -1.2118
 0.9000 | -0.9458
 1.2000 | -0.7878
 1.5000 | -0.6816
 1.8000 | -0.6010
 2.1000 |  2.9692
 2.4000 |  1.6787
 2.7000 |  1.5597
 3.0000 |  2.1951
 3.3000 | -3.3904
 3.6000 |  3.0060
 3.9000 |  3.1973