Lines Matching +full:range +full:- +full:double
1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
33 * jot - print sequential or random data
64 #define is_default(s) (*(s) == 0 || strcmp((s), "-") == 0)
67 static int prec = -1;
77 static int putdata(double, bool);
92 double begin = BEGIN_DEF; in main()
93 double divisor; in main()
94 double ender = ENDER_DEF; in main()
95 double s = STEP_DEF; in main()
96 double x, y; in main()
115 while ((ch = getopt(argc, argv, "b:cnp:rs:w:")) != -1) in main()
123 errx(1, "-%c word too long", ch); in main()
147 argc -= optind; in main()
163 ender = argv[2][strlen(argv[2])-1]; in main()
172 begin = argv[1][strlen(argv[1])-1]; in main()
195 if (prec == -1) in main()
209 s = ender > begin ? 1 : -1; in main()
218 reps = (ender - begin + s) / s; in main()
237 begin = ender - reps * s + s; in main()
248 ender = begin + reps * s - s; in main()
259 s = (ender - begin) / (reps - 1); in main()
266 long t = (ender - begin + s) / s; in main()
282 divisor = (double)INT32_MAX + 1; in main()
284 divisor = (double)UINT32_MAX + 1; in main()
288 * integer range within that of the random number in main()
290 * the range [begin .. ender]. Jot's default %.0f in main()
306 x = ender - begin; in main()
312 if (putdata(y * x + begin, !(reps - i))) in main()
313 errx(1, "range error in conversion"); in main()
317 if (putdata(x, !(reps - i))) in main()
318 errx(1, "range error in conversion"); in main()
328 * outside the range specified by the various flags.
331 putdata(double x, bool last) in putdata()
337 if (x <= (double)ULONG_MAX && x >= (double)0) in putdata()
342 if (x <= (double)LONG_MAX && x >= (double)LONG_MIN) in putdata()
347 if (x <= (double)INT_MAX && x >= (double)INT_MIN) in putdata()
352 if (x <= (double)UINT_MAX && x >= (double)0) in putdata()
369 "usage: jot [-cnr] [-b word] [-w word] [-s string] [-p precision]", in usage()
392 return (p - q); in getprec()
415 sz = sizeof(format) - strlen(format) - 1; in getformat()
418 errx(1, "-w word too long"); in getformat()
421 errx(1, "-w word too long"); in getformat()
425 errx(1, "-w word too long"); in getformat()
430 * %[#][ ][{+,-}][0-9]*[.[0-9]*]? where ? must be one of in getformat()
442 ((*p == '+' || *p == '-') && !(numbers|dot|sign++)) in getformat()
499 errx(1, "-w word too long"); in getformat()