File:  [CSRG BSD Unix] / 40BSD / libc / gen / rin.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:53 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD40
BSD 4.0

#include <stdio.h>

rin()
{
	double d;
	register n, c, f;

	d = 0.;
	f = 0;
	n = 0;
loop:
	c = getchar();
	if(c == EOF)
		exit();
	if(c == '-') {
		f++;
		goto loop;
	}
	if(c == '.') {
		n++;
		goto loop;
	}
	if(isdigit(c)) {
		if(n)
			n++;
		d = d*10.+c-'0';
		goto loop;
	}
	if(f)
		d = -d;
	for(f=1; f<n; f++)
		d /= 10.;
	n = d;
	return(n);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.