Skip to content

Instantly share code, notes, and snippets.

View KeithPinson's full-sized avatar
💭
Enjoying the day

Keith Pinson KeithPinson

💭
Enjoying the day
View GitHub Profile
@KeithPinson
KeithPinson / MorePrecisePi.md
Last active May 23, 2016 13:35
Values of Pi with Greater Precision

More Precise Values of Pi

math.Pi 

The math libraries of many languages define Pi as a Double, a 64-bit floating point value: 3.141592653589793

What do you do if you need greater precision? Well in Scala (and other JVM languages) you can use BigDecimal, see One Million Digits of Pi

@KeithPinson
KeithPinson / sternBrocotSequence.md
Last active May 22, 2016 19:21
Stern-Brocot Sequence

Stern-Brocot Sequence

The S-B Sequence has the curious ability, when taking adjacent pairs, to be able to represent all possible fractions without repeating any of them. The sequence is similar to a Fibonacci Sequence but with 2 members appended as it progresses rather than 1:

1, 1, 2, 1, 3, 2, 3, 1, 4, 3, 5, 2, 5, 3, 4
^  ^  
|  |            Append two members to the sequence, first: 

| +---- b

@KeithPinson
KeithPinson / helloworld_html.md
Last active December 18, 2015 07:49
A drop-in block of html with embedded script and styles -- ugly but does the job.

To see it in action, http://keithpinson.com/post/52143693200/hello-world/

<table>
    <!-- Hello, World!  Twenty Programming Languages of Significance (2013)

         Copyright (c) 2013 Keith Pinson.

         Colors from github: https://github.com/github/linguist/blob/master/lib/linguist/languages.yml