summaryrefslogtreecommitdiff
path: root/src/c/elementaryFunctions/radix_conversions/dec2oct/ddec2octs.c
blob: d06da30379b51cc3a23f4b8ae71e326190ac534b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <string.h>
#include <math.h>
#include "dec2oct.h"
#include <stdio.h>

void ddec2octs(double in,double* out)
{
	int i=0,j=0,tmp=0;
	int quotient;
	quotient=(int)in;
	while(quotient!=0)
	{
		out[i++]= quotient%8;
        	quotient=quotient/8;
	}
	j=i-1;
	i=0;
	
	while(i<j)
	{
		tmp=out[i];
		out[i]=out[j];
		out[j]=tmp;
		i++;
		j--;
	}	
}