Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am fabianlischka on github.
  • I am fab (https://keybase.io/fab) on keybase.
  • I have a public key whose fingerprint is 2BFE 74A9 BBF3 52DB 80B0 B64A 4EEA C244 94F9 1756

To claim this, I am signing this object:

@fabianlischka
fabianlischka / gist:8199483
Created December 31, 2013 16:54
Small helper function to represent a Float64 exactly
# reprExact is a small helper function that takes a float (currently only Float64)
# and returns an "exact" representation of that float. Invariant:
# x == eval(parse(reprExact(x))), and even
# bits(x) == bits(eval(parse(reprExact(x))))
# Not tested yet: subnormals, signaling NaNs, NaNs with payload
function reprExact(x::Float64)
w, p, bias = 11, 53, 1023 # 8,24,127 for float32
b = bits(x)
def naive_add(lis):
total = 0
for elem in lis:
total += elem
return total
def recursive_add(lis):
if len(lis) == 1:
return lis[0]
elif len(lis) == 0:
@fabianlischka
fabianlischka / gist:7443293
Last active December 28, 2015 04:29
An IJulia notebook describing an implementation of mod2pi(x), modpi(x), and modpio2(x), and related testing.
{
"metadata": {
"language": "Julia",
"name": "modpi"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [