Author Archives

n-pivot quicksort

2-pivot quicksort This posting on the Java core library mailing list proposes to replace the current quicksort with a new, 2-pivot quicksort. Ordinary quicksort in Haskell looks something like this: quicksort [] = [] quicksort (pivot:rest) = quicksort [x| x ← rest, x ≤ pivot] ++ [pivot] ++ quicksort [x| x ← rest, x > [...]

Debugging Turing: An excursion with Scheme

So, I thought it would be a fun idea for my first ever Lisp/Scheme program to implement Alan Turing’s original a-machines from his paper, On Computable Numbers, with an Application to the Entscheidungsproblem (paper available to public). Fun? Oh, I hadn’t any idea… Preamble; choice of implementation I decided to go with the latest and [...]

Sometimes it’s all too much…

Argh #include <stdio.h> #include <math.h> #include <fenv.h>   int main () { // don’t set rounding here double ten0 = sin(pow(10.0,22));   fesetround(FE_DOWNWARD); double ten1 = sin(pow(10.0,22));   fesetround(FE_UPWARD); double ten2 = sin(pow(10.0,22));   fesetround(FE_TONEAREST); double ten3 = sin(pow(10.0,22));   fesetround(FE_TOWARDZERO); double ten4 = sin(pow(10.0,22));   printf( "Default: %f\n" "Downward: %f\n" "Upward: %f\n" "ToNearest: %f\n" [...]

Symbols used to represent functions

I was looking for some standard symbols to represent the Control key and the Alt key, and couldn’t find one until I came across ISO/IEC 9995-7. Because I had much trouble finding a free copy of the document on the ’Net, I have made a table of the symbols and their functions below. I have [...]