Skip to content

Instantly share code, notes, and snippets.

@wilzbach
wilzbach / output
Created July 31, 2016 17:59
FP differences between 32 & 64-bit
> rdmd -unittest -main ele.d
-0x1.820d74p-3
-0x1.820d74p-3
> rdmd -unittest -main-m32 ele.d
-0x1.820d76p-3
-0x1.820d74p-3
@wilzbach
wilzbach / output
Created June 29, 2016 17:59
Different floating point behavior
type: float
iv1: -0x1p+0, -0x1.ccccccp-1
Interval!float(-1, -0.9, 2, 0, -nan, 0.118267, 2.00563, LinearFun!float(nan, nan, nan), LinearFun!float(nan, nan, nan))
iv.lx -1.0000000000 (-0x1p+0)
hat.a 0.1182672605 (0x1.e46c36p-4)
hat.slope 1.1826723814 (0x1.2ec39ep+0)
hat.y -0.8999999762 (-0x1.ccccccp-1)
hat(p1) -0.0000000075 (-0x1p-27) //-0
hat(p2) 0.1182672605 (0x1.e46c36p-4)
---
@wilzbach
wilzbach / output
Last active June 29, 2016 14:34
Tricky enum bug with ranges
iv: -0x1p+0, -0x1.ccccccccccccdp-1
iv: -0x1p+0, -0x1.ccccccccccccdp-1
Interval!real(-1, -0.9, 2, 0, -nan, 0.118267, 2.00562, LinearFun!real(nan, nan, nan), LinearFun!real(nan, nan, nan))
---
iv.lx -1.0000000000 (-0x8p-3)
hat.a 0.1182672100 (0xf.23614391d01ffb5p-7)
hat.slope 1.1826721000 (0x9.761cca3b2214947p-3)
hat.y -0.9000000000 (-0xe.6666666666668p-4)
hat(p1) 0.0000000000 (0x0p+0)
hat(p2) 0.1182672100 (0xf.23614391d01ffb5p-7)
@wilzbach
wilzbach / index.js
Last active August 29, 2015 14:08
requirebin sketch
var parser = require("biojs-io-snipspector");
var _ = require("underscore");
var vis = function(opts){
var divEl = opts.el;
var self = this; // save reference to itself (in callbacks this is different)
var el = divEl;
parser.read("http://files.biojs.net/chromosomes/manny", function(result){
for(var i=0; i < result.length; i++) {
@wilzbach
wilzbach / index.js
Created September 18, 2014 00:58
requirebin sketch
var parser = require("biojs-io-newick").parse_nwk;
var canvas = document.createElement("canvas")
canvas.width = 500
canvas.height = 500
document.body.appendChild(canvas)
var context = canvas.getContext("2d")
context.lineWidth = 5;
context.font="16px Arial";
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://wzrd.in/bundle/biojs-vis-chromosome@latest"></script>
<link rel="stylesheet" href="https://raw.githubusercontent.com/4ndr01d3/js-components/master/util-area_selector/css/area_selector.css">
<link rel="stylesheet" href="https://raw.githubusercontent.com/4ndr01d3/js-components/master/biojs-vis-chromosome/css/chromosome.css">
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css">
<div id='yourDiv'></div>
@wilzbach
wilzbach / index.js
Last active August 29, 2015 14:05
Clustal example
// load the module
var Clustal = require("biojs-io-clustal");
// console
var current = document.createElement('p');
document.body.appendChild(current);
Clustal.read("http://dev.biojs-msa.org/v1/dummy/samples/p53.clustalo.clustal", function(seqs){
current.innerHTML = seqs.length + " seqs have been loaded";
})