|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T s
Length: 962 (0x3c2)
Types: TextFile
Names: »series.c«
└─⟦87ddcff64⟧ Bits:30001253 CPHDIST85 Tape, 1985 Autumn Conference Copenhagen
└─⟦this⟧ »cph85dist/stat/src/series.c«
#include "unixstat.h"
PGM(series,Print a Series of Numbers,5.1,1985)
/* Copyright (c) 1982 Gary Perlman (see Copyright file) */
main (argc, argv) char **argv;
{
double low, high, incr = 1.0;
ARGV0;
if (argc != 3 && argc != 4)
USAGE (low high [incr])
else
{
if (!number (argv[1]))
ERRNUM (argv[1],series start)
else low = atof (argv[1]);
if (!number (argv[2]))
ERRNUM (argv[2],series end)
else high = atof (argv[2]);
if (argc > 3)
if (!number (argv[3]))
ERRNUM (argv[3],increment)
else incr = atof (argv[3]);
else if (low > high) incr = -incr;
}
if ((low < high && incr <= 0.0) || (low > high && incr >= 0.0))
ERRMSG3 (Adding %g to %g will never reach %g, incr, low, high)
if (low == high)
printf ("%g\n", low);
else if (low < high)
while (low <= high)
{
printf ("%g\n", low);
low += incr;
}
else if (low > high)
while (low >= high)
{
printf ("%g\n", low);
low += incr;
}
exit (0);
}