Skip to content

float

an approximate decimal number

1
# float: an approximate decimal
2
1.5e31500
3
# from a fraction
4
1/3 to float0.333333
Example outputCtrl+Enter to run
1
# to float converts
2
"2.5" to float2.5
Example outputCtrl+Enter to run
  • int convert to an integer, dropping any fractional part
  • float convert to a float
  • frac show a number as a fraction, like 7/2, or as text rounded to the nearest 1/den, like “2 11/16 in”
  • range the integers from 0 up to n, or from a up to b, not including the end, or with a step the numbers or quantities between
  • progress a progress bar filled to frac, from 0 (empty) to 1 (full), width characters wide
  • sqrt square root
  • abs the value without its sign, so -3 becomes 3
  • round round to the nearest whole number, or to digits decimal places
  • sig round to that many significant figures (digits counted from the first non-zero one)
  • floor round down to a whole number
  • ceil round up to a whole number
  • trunc drop the fractional part, rounding toward zero
  • sign -1 if x is negative, 0 if it’s zero, 1 if it’s positive
  • cbrt cube root
  • exp e (2.718…) to the power x
  • ln natural logarithm, the log base e
  • log logarithm base 10, or in the base given
  • nth_root the nth root of x, so nth_root(27, 3) is 3
  • log2 logarithm base 2
  • log10 logarithm base 10
  • exp2 2 to the power x
  • exp10 10 to the power x
  • hypot the length of the long side of a right triangle with sides x and y, sqrt(x² + y²)
  • sum add up a list, units included
  • avg the mean (average), or with weights, the mean where each item counts as many times as its weight
  • product multiply all the items together
  • median the middle value once sorted, or with an even count, halfway between the middle two
  • variance how spread out the numbers are
  • stdev how spread out the numbers are, in the same units as them
  • geo_mean the geometric mean: the nth root of the product, the right average for growth factors
  • harmonic_mean the harmonic mean: the reciprocal of the average reciprocal, the right average for rates
  • rms the root mean square: the square root of the average of the squares
  • mad the median absolute deviation: the median distance from the median, a spread that outliers barely move
  • sem the standard error of the mean: the standard deviation divided by the square root of the count
  • iqr the interquartile range: the 75th percentile minus the 25th
  • sin the sine of an angle, in radians or an angle unit
  • cos the cosine of an angle, in radians or an angle unit
  • tan the tangent of an angle, in radians or an angle unit
  • asin the angle whose sine is x (arcsine)
  • acos the angle whose cosine is x (arccosine)
  • atan the angle whose tangent is x (arctangent)
  • atan2 the angle from the positive x axis to the point (x, y), from -180° to 180°
  • sinh the hyperbolic sine, (eˣ - e⁻ˣ) / 2
  • cosh the hyperbolic cosine, (eˣ + e⁻ˣ) / 2
  • tanh the hyperbolic tangent, sinh(x) / cosh(x)
  • csc the cosecant of an angle, 1 / sin(x)
  • secant the secant of an angle, 1 / cos(x), not to be confused with sec for seconds
  • cot the cotangent of an angle, 1 / tan(x)
  • acsc the angle whose cosecant is x
  • asec the angle whose secant is x
  • acot the angle whose cotangent is x
  • asinh the inverse hyperbolic sine
  • acosh the inverse hyperbolic cosine, for x of 1 or more
  • atanh the inverse hyperbolic tangent, for x between -1 and 1
  • sech the hyperbolic secant, 1 / cosh(x)
  • csch the hyperbolic cosecant, 1 / sinh(x)
  • coth the hyperbolic cotangent, 1 / tanh(x)
  • sinc the normalized sinc function, sin(pi x) / (pi x), which is 1 at 0
  • choose how many ways there are to pick k things from n when order doesn’t matter (the binomial coefficient), exact
  • rem the remainder of a divided by b, with the same sign as a, as C’s and JavaScript’s % give it
  • numerator the numerator of a fraction in lowest terms, or of a whole number itself
  • denominator the denominator of a fraction in lowest terms, or 1 for a whole number
  • frac_part the part of x after the point, keeping its sign: frac_part(-2.25) is -0.25
  • cfrac x as a continued fraction, the list [a0, a1, a2, …] meaning a0 + 1/(a1 + 1/(a2 + …))
  • to_fixed x as a fixed-point integer with int_bits whole bits and frac_bits fractional ones, rounded, shown in hex
  • float_bits the bit pattern of x in a float format, shown in hex
  • float_parts the sign, exponent and mantissa fields of x as stored, as a map
  • nearest_float x rounded to the nearest number a float format can store
  • float_error how far x is from the nearest number a float format can store, as nearest minus x
  • normal_pdf the probability density of a normal distribution at x, how likely values near x are
  • normal_cdf the chance that a normal variable is at most x
  • normal_inv the value that a normal variable falls below with chance p, the reverse of normal_cdf
  • t_pdf the probability density of a Student’s t distribution at x, how likely values near x are
  • t_cdf the chance that a Student’s t variable is at most x
  • t_inv the value that a Student’s t variable falls below with chance p, the reverse of t_cdf
  • chi2_pdf the probability density of a chi-squared distribution at x, how likely values near x are
  • chi2_cdf the chance that a chi-squared variable is at most x
  • chi2_inv the value that a chi-squared variable falls below with chance p, the reverse of chi2_cdf
  • f_pdf the probability density of an F distribution at x, how likely values near x are
  • f_cdf the chance that an F variable is at most x
  • f_inv the value that an F variable falls below with chance p, the reverse of f_cdf
  • exp_pdf the probability density of an exponential distribution at x, how likely values near x are
  • exp_cdf the chance that an exponential variable is at most x
  • exp_inv the value that an exponential variable falls below with chance p, the reverse of exp_cdf
  • gamma_pdf the probability density of a gamma distribution at x, how likely values near x are
  • gamma_cdf the chance that a gamma variable is at most x
  • gamma_inv the value that a gamma variable falls below with chance p, the reverse of gamma_cdf
  • beta_pdf the probability density of a beta distribution at x, how likely values near x are
  • beta_cdf the chance that a beta variable is at most x
  • beta_inv the value that a beta variable falls below with chance p, the reverse of beta_cdf
  • weibull_pdf the probability density of a Weibull distribution at x, how likely values near x are
  • weibull_cdf the chance that a Weibull variable is at most x
  • weibull_inv the value that a Weibull variable falls below with chance p, the reverse of weibull_cdf
  • cauchy_pdf the probability density of a Cauchy distribution at x, how likely values near x are
  • cauchy_cdf the chance that a Cauchy variable is at most x
  • cauchy_inv the value that a Cauchy variable falls below with chance p, the reverse of cauchy_cdf
  • logistic_pdf the probability density of a logistic distribution at x, how likely values near x are
  • logistic_cdf the chance that a logistic variable is at most x
  • logistic_inv the value that a logistic variable falls below with chance p, the reverse of logistic_cdf
  • pareto_pdf the probability density of a Pareto distribution at x, how likely values near x are
  • pareto_cdf the chance that a Pareto variable is at most x
  • pareto_inv the value that a Pareto variable falls below with chance p, the reverse of pareto_cdf
  • rayleigh_pdf the probability density of a Rayleigh distribution at x, how likely values near x are
  • rayleigh_cdf the chance that a Rayleigh variable is at most x
  • rayleigh_inv the value that a Rayleigh variable falls below with chance p, the reverse of rayleigh_cdf
  • binom_inv the fewest successes in n tries with chance p each that are at least as likely as q to be reached, the reverse of binom_cdf
  • poisson_inv the fewest events that are at least as likely as q to be reached when rate are expected, the reverse of poisson_cdf
  • rand_normal a random number from a normal distribution with that mean and sd, or a list of n of them
  • rand_exp a random wait from an exponential distribution with that rate, or a list of n of them
  • rand_poisson a random event count from a Poisson distribution with that rate, or a list of n of them
  • hex an integer in hex, the same as v to hex
  • bin an integer in binary, the same as v to bin
  • oct an integer in octal, the same as v to oct
  • dec an integer in decimal, the same as v to dec
  • base an integer in any base from 2 to 62, the same as v to base(b)
  • base_table a one-row table of an integer in binary, octal, decimal and hex
  • fixed x as text with exactly that many decimals, padding with zeros if needed
  • sci x as text in scientific notation, like 1.23e5 for 123000, with digits decimals
  • eng x as text in engineering notation, with the exponent a multiple of 3, like 123.457e6, with digits decimals
  • mixed_frac a number as a mixed fraction text, like “1 1/4” for 1.25, optionally rounded to the nearest 1/den
  • percent a fraction as percentage text, so 0.256 is “25.6%”, with digits decimals
  • commas x as text with commas between thousands, like “1,234,567”, with digits decimals
  • short_scale a number as compact text with a short-scale word, like “2.5 million”
  • human_bytes a number of bytes as text in the largest binary unit that fits, like “117.7 MiB”, with one decimal
  • dms an angle as degrees, arcminutes and arcseconds text, like 52°20′24″
  • lat a latitude in degrees as text with N or S, like 7°19′48″S
  • lon a longitude in degrees as text with E or W, like 74°0′21″W
  • rand a random decimal from 0 up to but not including 1
  • odds a probability as “1 in N”, with a familiar event that’s about as likely, to give a feel for it
  • re the real part
  • im the imaginary part, as a plain number
  • conj the complex conjugate: the same number with its imaginary part negated
  • arg the angle from the positive real axis to the number, as an angle unit
  • csqrt square root that gives a complex number for negatives, so csqrt(-4) is 2i
  • croots all n complex nth roots of a number, as a list
  • polar make a complex number from its polar form, or with one argument show z in that form
  • gamma the gamma function, which extends the factorial: gamma(n + 1) is n!, and it works between whole numbers too
  • lgamma the natural log of the gamma function, which stays finite where gamma itself is too large
  • beta the beta function, gamma(a) × gamma(b) / gamma(a + b)
  • erf the error function: the chance a normal variable lands within x√2 standard deviations of its mean
  • erfc the complementary error function, 1 - erf(x), accurate even where that would round to 0
  • digamma the digamma function, the slope of lgamma: the derivative of ln(gamma(x))
  • zeta the Riemann zeta function, the sum of 1 / n^s over every whole number n from 1
  • erf_inv the inverse of the error function: the x where erf(x) is y, for y between -1 and 1
  • probit the normal quantile: the z where a standard normal variable falls below z with chance p
  • gamma_inc the regularized lower incomplete gamma function: the share of gamma(a) accumulated up to x, from 0 to 1
  • beta_inc the regularized incomplete beta function: the share of beta(a, b) accumulated up to x, for x from 0 to 1
  • sigmoid the logistic curve 1 / (1 + e^-x): an S shape from 0 to 1
  • logit the inverse of sigmoid, ln(p / (1 - p)), for p between 0 and 1
  • heaviside the step function: 0 below zero, 1 above, and 1/2 at zero
  • ramp the ramp function: 0 below zero, and x above
  • rect the rectangle pulse: 1 for x within 1/2 of zero, 1/2 at the edges, 0 beyond
  • tri the triangle pulse: 1 at zero, falling in straight lines to 0 at 1 and -1
  • db a ratio of two powers in decibels, as 10 × log10(ratio), so doubling is about +3 dB
  • from_db decibels back to the ratio of powers, the reverse of db
  • grow what money will be worth after time at the rate
  • present_value what a future sum, and any regular payments up to then, are worth today at the rate
  • npv the net present value of a list of cash flows: each is discounted by the rate for every period since the first, which is now
  • loan_rate the yearly rate of a loan from its monthly payment (the annual percentage rate, compounding monthly)
  • depreciation a schedule of how an asset loses value over its life, a row per year
  • cagr the steady yearly growth rate that would take start to end over time (compound annual growth rate)
  • real_rate what a return is really worth once inflation is taken out
  • payment the monthly payment that pays off a loan over time, interest included
  • payoff how long a regular payment takes to pay off a balance with interest, rounded up to whole payments
  • amortize a loan’s month-by-month schedule
  • share split a sum into parts, in equal shares or by the weights in a list, rounded to the cent so they still add up exactly
  • change how much a value changed, as a fraction of where it started
  • margin profit as a fraction of the selling price
  • markup profit as a fraction of what it cost you
  • sunrise when the sun rises at a place on a day, or nil if it doesn’t rise or doesn’t set that day
  • sunset when the sun sets at a place on a day, or nil if it doesn’t rise or doesn’t set that day
  • day_length how long the sun is up at a place on a day: 0 h if it never rises, 24 h if it never sets
  • nearest the city closest to a latitude and longitude, out of those zil knows
  • rgb make a color from red, green and blue amounts (0-255), or give one argument to get a color’s three amounts
  • hsl make a color from hue, saturation and lightness, or give one argument to get a color’s three values
  • ram_latency the true latency of memory in ns, from its transfer rate in MT/s and CAS latency cl

Example results generated on 2026-11-04. Ones using now, today or randomness will differ when you run them.