Skip to content

Instantly share code, notes, and snippets.

@tyabu12
Last active April 19, 2017 02:45
Show Gist options
  • Save tyabu12/187dddfa963987d4c9eb385f20210983 to your computer and use it in GitHub Desktop.
Save tyabu12/187dddfa963987d4c9eb385f20210983 to your computer and use it in GitHub Desktop.
let print x y z =
let print_line mode mode_name =
Printf.printf " round %s:\n x + y = %.18e\n x + z = %.18e\n"
mode_name (Round.add mode x y) (Round.add mode x z) in
Printf.printf "x = %e, y = %e, z = %e\n" x y z;
print_line Round.NearestTiesToEven "NearestTiesToEven";
print_line Round.ToZero "ToZero";
print_line Round.Up "Up";
print_line Round.Down "Down";
Printf.printf "\n"
let _ =
print 1.0 1e-40 (-1e-40);
print (-1.0) 1e-40 (-1e-40)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment