Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/vis15/src/compiler/basis/math-fns.sml
ViewVC logotype

View of /branches/vis15/src/compiler/basis/math-fns.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3582 - (download) (annotate)
Wed Jan 13 22:14:05 2016 UTC (3 years, 9 months ago) by jhr
File size: 1487 byte(s)
working on merge
(* math-fns.sml
 *
 * Math functions that have not been lifted to work on fields.
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2015 The University of Chicago
 * All rights reserved.
 *)

structure MathFns =
  struct

    datatype t = ATAN2 | CEIL | FLOOR | FMOD | ERF | ERFC | LOG | LOG10 | LOG2 | POW

    fun toString f = (case f
	   of ATAN2 => "atan2"
	    | CEIL  => "ceil"
	    | FLOOR => "floor"
	    | FMOD  => "fmod"
	    | ERF   => "erf"
	    | ERFC  => "erfc"
	    | LOG   => "log"
	    | LOG10 => "log10"
	    | LOG2  => "log2"
	    | POW   => "pow"
	  (* end case *))

    fun hash f = (case f
	   of ATAN2 => 0w101
	    | CEIL  => 0w103
	    | FLOOR => 0w107
	    | FMOD  => 0w109
	    | ERF   => 0w113
	    | ERFC  => 0w137
	    | LOG   => 0w139
	    | LOG10 => 0w149
	    | LOG2  => 0w151
	    | POW   => 0w157
	  (* end case *))

    fun same (ATAN2, ATAN2) = true
      | same (CEIL, CEIL) = true
      | same (FLOOR, FLOOR) = true
      | same (FMOD, FMOD) = true
      | same (ERF, ERF) = true
      | same (ERFC, ERFC) = true
      | same (LOG, LOG) = true
      | same (LOG10, LOG10) = true
      | same (LOG2, LOG2) = true
      | same (POW, POW) = true
      | same _ = false

    fun arity f = (case f
	   of ATAN2 => 2
	    | CEIL => 1
	    | FLOOR => 1
	    | FMOD => 2
	    | ERF => 1
	    | ERFC => 1
	    | LOG => 1
	    | LOG10 => 1
	    | LOG2 => 1
	    | POW => 2
	  (* end case *))

  end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0