Skip to content

Instantly share code, notes, and snippets.

@sshine
Created September 3, 2012 12:36
Show Gist options
  • Save sshine/3609048 to your computer and use it in GitHub Desktop.
Save sshine/3609048 to your computer and use it in GitHub Desktop.
afrunding
fun afrund n =
let
val n' = Real.trunc (n * 125.0)
val kr = Real.fromInt (n' div 100)
val ore = Real.fromInt ((n' mod 100) div 25 * 25) / 100.0
in kr + ore end
(* Mads og Christians *)
fun moms n = real(round(n * 4.0 * 1.25 ))/4.0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment