Skip to content

Instantly share code, notes, and snippets.

View lendle's full-sized avatar

Sam Lendle lendle

  • UC Berkeley
  • Berkeley, CA
View GitHub Profile
@houshuang
houshuang / gist:6748566
Created September 29, 2013 01:45
Automatically open function in Sublime Text (first Julia macro)
macro whichs(ex)
ex = expand(ex)
exret = Expr(:call, :error, "expression is not a function call")
if !isa(ex, Expr)
# do nothing -> error
elseif ex.head == :call
exret = Expr(:call, :whichs, map(esc, ex.args)...)
elseif ex.head == :body
a1 = ex.args[1]
if isa(a1, Expr) && a1.head == :call
@simonbyrne
simonbyrne / IBMFloat64.jl
Created April 23, 2013 14:07
converts 64bit IBM floating point numbers to IEEE754 64bit floats
import Base.convert
bitstype 64 IBMFloat64
# ibm float format is hex based:
# * bit 1 = sign
# * bits 2-8 = exponent to the power of 16, with bias of 64
# * bits 9-64 = mantissa: no implied leading 1 (unlike ieee),
# typically normalised (hex of bits 9-12 is non-zero), though this need
# not be the case