Changeset b11fac4 for src/libcfa/rational.c
- Timestamp:
- Apr 13, 2016, 5:40:32 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 02af22de
- Parents:
- 02ad3f5 (diff), 45161b4d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/rational.c
r02ad3f5 rb11fac4 11 11 // Created On : Wed Apr 6 17:54:28 2016 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Fri Apr 8 17:35:05201614 // Update Count : 1813 // Last Modified On : Tue Apr 12 21:26:42 2016 14 // Update Count : 21 15 15 // 16 16 … … 19 19 #include "stdlib" 20 20 21 extern "C" {22 #include <stdlib.h> // exit23 } // extern24 25 21 26 22 // constants … … 30 26 31 27 32 // helper 28 // helper routines 33 29 34 30 // Calculate greatest common denominator of two numbers, the first of which may be negative. Used to reduce rationals. 31 // alternative: https://en.wikipedia.org/wiki/Binary_GCD_algorithm 35 32 static long int gcd( long int a, long int b ) { 36 33 for ( ;; ) { // Euclid's algorithm
Note:
See TracChangeset
for help on using the changeset viewer.