This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| with Ada.Text_IO, Ada.Command_line, Ada.Assertions; | |
| use Ada.Text_IO, Ada.Assertions; | |
| with Polynomials; | |
| use Polynomials; | |
| -- Test file format: | |
| -- # comments start with hash character | |
| -- 1.0 X 1 Y 2 2.0 X 2 Y 0 | |
| -- + | |
| -- 1.0 X 1 Y 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const int base = 10000; | |
| class BigFloat { | |
| public: | |
| // default constructor, initialize to 0 | |
| BigFloat () : _sign(1), _exp(0) { } | |
| // initialize with preallocated mantissa | |
| BigFloat (char s, int e, const Mantissa& m) :_sign(s), _exp(e), _mantissa(m) {} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (define (weave xs ys zs) | |
| (if | |
| (or (null? xs) (null? ys) (null? zs)) | |
| '() | |
| (cons (list (car xs) (car ys) (car zs)) | |
| (weave (cdr xs) (cdr ys) (cdr zs))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val rec iter = fn 0 => (fn f => fn x => x) | n => (fn f => fn x => (f o (iter (n-1) f)) x); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .globl twice.2 | |
| .align 16, 0x90 | |
| twice.2: | |
| addsd %xmm0, %xmm0 | |
| ret |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define double @twice.2(double %x.31) nounwind { | |
| entry: | |
| %multiply_result = fmul double %x.31, 2.000000e+00 | |
| ret double %multiply_result | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def twice.2(x :: float64): | |
| return mul<float64>(2.0 :: float64, x :: float64) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @parakeet.jit | |
| def twice(x): | |
| return 2*x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def twice(x): | |
| return mul(2, x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @parakeet.jit | |
| def count_thresh(vec, thresh): | |
| """ | |
| Given a vector of values, counts the number of | |
| elements greater, less, or equal to a threshold | |
| """ | |
| n_less = 0 | |
| n_greater = 0 | |
| n_eq = 0 | |
| for elt in vec: |
OlderNewer