File: real.sail

package info (click to toggle)
sail-ocaml 0.19.1%2Bdfsg5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,008 kB
  • sloc: ml: 75,941; ansic: 8,848; python: 1,342; exp: 560; sh: 474; makefile: 218; cpp: 36
file content (26 lines) | stat: -rw-r--r-- 812 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

$include <arith.sail>
$include <real.sail>

val main : unit -> unit

function main() = {
  let x : real = 16.0;
  print_real("1: ", x);
  print_int("1: ", floor(x));
  print_int("1: ", ceil(x));
  print_real("1: ", sqrt(x));
  print_int("1: ", floor(sqrt(x)));
  print_int("1: ", ceil(sqrt(x)));
  let x : real = 17.0;
  print_real("2: ", x);
  print_int("2: ", floor(x));
  print_int("2: ", ceil(x));
  print_real("2: ", sqrt(x));
  print_int("2: ", floor(sqrt(x)));
  print_int("2: ", ceil(sqrt(x)));
  let x : real = 0.00000000015;
  print_real("3: ", sqrt(x));
  let x : real = 57220458984375.0 / 123665200736552267030251260509823595017565674550605919957031528046448612553265933585158200530621522494798835713008069669675682517153375604983773077550946583958303386074349568.0;
  print_real("4: ", sqrt(x));
}