File: md.ml

package info (click to toggle)
ocamlcreal 0.7-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, squeeze, stretch, wheezy
  • size: 384 kB
  • ctags: 751
  • sloc: ml: 2,699; ansic: 1,067; makefile: 15
file content (22 lines) | stat: -rw-r--r-- 839 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
open Creal;;
open Infixes;;

print_endline (
  to_string 
    (match int_of_string (Sys.argv.(2)) with
      | 1-> sin(tan(cos one))
      | 2 -> sqrt (e /! pi)
      | 3 -> sin (pow_int (e +! one) 3)
      | 4 -> pow e (pi *! sqrt (of_int 2011)) 
      | 5 -> pow e (pow e (sqrt e))
      | 6 -> arctanh (one -! arctanh (one -! arctanh (one -! arctanh (one/!pi))))
      | 7 -> pow_int pi 1000
      | 8 -> sin (of_float (6.**(6.**6.)))
      | 9 -> sin (of_int 10 *! arctanh(tanh(pi *! sqrt(of_int 2011) /! of_int 3)))
      | 10 -> root 3 (of_int 7 +! root 5 (of_int 2) -! of_int 5 *! root 5 (of_int 8)) +! root 5 (of_int 4) -! root 5 (of_int 2)
      | 11 -> tan (sqrt two) +! arctanh(sin one)
      | 12 -> arcsin(inv e) +! cosh e +! arctanh e
      | _ -> failwith "unknown problem number"
    )
    (int_of_string Sys.argv.(1))
);;