var e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2);
function tickSpec(i, a, o) {
	let s = (a - i) / Math.max(0, o), c = Math.floor(Math.log10(s)), l = s / 10 ** c, u = l >= e10 ? 10 : l >= e5 ? 5 : l >= e2 ? 2 : 1, d, f, p;
	return c < 0 ? (p = 10 ** -c / u, d = Math.round(i * p), f = Math.round(a * p), d / p < i && ++d, f / p > a && --f, p = -p) : (p = 10 ** c * u, d = Math.round(i / p), f = Math.round(a / p), d * p < i && ++d, f * p > a && --f), f < d && .5 <= o && o < 2 ? tickSpec(i, a, o * 2) : [
		d,
		f,
		p
	];
}
function ticks(e, t, n) {
	if (t = +t, e = +e, n = +n, !(n > 0)) return [];
	if (e === t) return [e];
	let i = t < e, [a, o, s] = i ? tickSpec(t, e, n) : tickSpec(e, t, n);
	if (!(o >= a)) return [];
	let c = o - a + 1, l = Array(c);
	if (i) if (s < 0) for (let e = 0; e < c; ++e) l[e] = (o - e) / -s;
	else for (let e = 0; e < c; ++e) l[e] = (o - e) * s;
	else if (s < 0) for (let e = 0; e < c; ++e) l[e] = (a + e) / -s;
	else for (let e = 0; e < c; ++e) l[e] = (a + e) * s;
	return l;
}
function tickIncrement(e, t, n) {
	return t = +t, e = +e, n = +n, tickSpec(e, t, n)[2];
}
function tickStep(e, t, n) {
	t = +t, e = +e, n = +n;
	let r = t < e, i = r ? tickIncrement(t, e, n) : tickIncrement(e, t, n);
	return (r ? -1 : 1) * (i < 0 ? 1 / -i : i);
}
export { ticks as default, tickIncrement, tickStep };
