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
| #!/bin/bash | |
| set -ex | |
| cd ~ | |
| TMP_DIR=`mktemp -d --suffix=-home` | |
| # すべてのファイルを一時的に退避 | |
| sudo mv * .[^\.]* $TMP_DIR |
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
| theory Situation | |
| type person = A | B | C | |
| type status = Honest | Liar | |
| function status (person) : status | |
| axiom Honest_is_the_only_one: | |
| (status A = Honest /\ status B = Liar /\ status C = Liar) \/ | |
| (status A = Liar /\ status B = Honest /\ status C = Liar) \/ | |
| (status A = Liar /\ status B = Liar /\ status C = Honest) |
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
| require './vb' | |
| filename = ARGV[0] | |
| File.open(filename, 'rb') do |file| | |
| until file.eof | |
| # ほげほげ | |
| puts "#{tag}\t#{numbers.join(',')}" | |
| end | |
| end |
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
| require './vb' | |
| filename = ARGV[0] | |
| File.open(filename, 'r').each_line do |line| | |
| line.chomp! # 末尾の改行を削除 | |
| # ほげほげ | |
| print [tag.bytesize, vb.bytesize], tag, vb | |
| end |
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
| module VB | |
| # 整数nの符号化 | |
| # バイト列のバイナリへの変換を忘れないこと! | |
| def self.encode_number(n) | |
| bytes = [] | |
| # ほげほげ | |
| bytes # このままだと… | |
| end |
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
| CAMLC = ocamlc | |
| CAMLOPT = ocamlopt | |
| CAMLMKLIB = ocamlmklib | |
| EXEC = test testopt | |
| all: round.cma round.cmxa $(EXEC) | |
| round.o: round.c | |
| $(CAMLC) -c $< |
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
| x = 1.000000e+00, y = 1.000000e-40, z = -1.000000e-40 | |
| round NearestTiesToEven: | |
| x + y = 1.000000000000000000e+00 | |
| x + z = 1.000000000000000000e+00 | |
| round ToZero: | |
| x + y = 1.000000000000000000e+00 | |
| x + z = 9.999999999999998890e-01 | |
| round Up: | |
| x + y = 1.000000000000000222e+00 | |
| x + z = 1.000000000000000000e+00 |
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
| 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" |
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
| #include <stdio.h> | |
| #include <math.h> | |
| #include <fenv.h> | |
| #include <assert.h> | |
| #include <caml/mlvalues.h> | |
| #include <caml/alloc.h> | |
| static void change_round_mode(int mode) { | |
| switch (mode) { | |
| case NearestTiesToEven: |
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
| type round_mode = | |
| | NearestTiesToEven | |
| | ToZero | |
| | Up | |
| | Down | |
| (* | NearestTiesToAway *) | |
| external add: round_mode -> float -> float -> float = "addc" |