Skip to content

Instantly share code, notes, and snippets.

@mrgame64
mrgame64 / FloatSwitch.h
Last active August 29, 2015 14:08
A hack to switch between float and double with just a #define
//uncomment the line below to use 'double', or else leave it commented to use 'float'
//#define DOUBLE_PREC
#ifdef DOUBLE_PREC
typedef double fp;
#else
typedef float fp;
#endif
//use 'fp' instead of 'float' or 'double' in your code
@mrgame64
mrgame64 / sunrise-sunset_algorithm.txt
Created October 25, 2014 09:12
Sunrise/Sunset Algorithm
Source:
Almanac for Computers, 1990
published by Nautical Almanac Office
United States Naval Observatory
Washington, DC 20392
Inputs:
day, month, year: date of sunrise/sunset
latitude, longitude: location for sunrise/sunset
zenith: Sun's zenith for sunrise/sunset