float
an approximate decimal number
1# float: an approximate decimal21.5e315003# from a fraction41/3 to float0.333333Example outputCtrl+Enter to run
syntax
Section titled “syntax”1# to float converts2"2.5" to float2.5Example outputCtrl+Enter to run
Functions that take it
Section titled “Functions that take it”intconvert to an integer, dropping any fractional partfloatconvert to a floatfracshow a number as a fraction, like 7/2, or as text rounded to the nearest 1/den, like “2 11/16 in”rangethe integers from 0 up to n, or from a up to b, not including the end, or with a step the numbers or quantities betweenprogressa progress bar filled to frac, from 0 (empty) to 1 (full), width characters widesqrtsquare rootabsthe value without its sign, so -3 becomes 3roundround to the nearest whole number, or to digits decimal placessiground to that many significant figures (digits counted from the first non-zero one)floorround down to a whole numberceilround up to a whole numbertruncdrop the fractional part, rounding toward zerosign-1 if x is negative, 0 if it’s zero, 1 if it’s positivecbrtcube rootexpe (2.718…) to the power xlnnatural logarithm, the log base eloglogarithm base 10, or in the base givennth_rootthe nth root of x, so nth_root(27, 3) is 3log2logarithm base 2log10logarithm base 10exp22 to the power xexp1010 to the power xhypotthe length of the long side of a right triangle with sides x and y, sqrt(x² + y²)sumadd up a list, units includedavgthe mean (average), or with weights, the mean where each item counts as many times as its weightproductmultiply all the items togethermedianthe middle value once sorted, or with an even count, halfway between the middle twovariancehow spread out the numbers arestdevhow spread out the numbers are, in the same units as themgeo_meanthe geometric mean: the nth root of the product, the right average for growth factorsharmonic_meanthe harmonic mean: the reciprocal of the average reciprocal, the right average for ratesrmsthe root mean square: the square root of the average of the squaresmadthe median absolute deviation: the median distance from the median, a spread that outliers barely movesemthe standard error of the mean: the standard deviation divided by the square root of the countiqrthe interquartile range: the 75th percentile minus the 25thsinthe sine of an angle, in radians or an angle unitcosthe cosine of an angle, in radians or an angle unittanthe tangent of an angle, in radians or an angle unitasinthe angle whose sine is x (arcsine)acosthe angle whose cosine is x (arccosine)atanthe angle whose tangent is x (arctangent)atan2the angle from the positive x axis to the point (x, y), from -180° to 180°sinhthe hyperbolic sine, (eˣ - e⁻ˣ) / 2coshthe hyperbolic cosine, (eˣ + e⁻ˣ) / 2tanhthe hyperbolic tangent, sinh(x) / cosh(x)cscthe cosecant of an angle, 1 / sin(x)secantthe secant of an angle, 1 / cos(x), not to be confused withsecfor secondscotthe cotangent of an angle, 1 / tan(x)acscthe angle whose cosecant is xasecthe angle whose secant is xacotthe angle whose cotangent is xasinhthe inverse hyperbolic sineacoshthe inverse hyperbolic cosine, for x of 1 or moreatanhthe inverse hyperbolic tangent, for x between -1 and 1sechthe hyperbolic secant, 1 / cosh(x)cschthe hyperbolic cosecant, 1 / sinh(x)coththe hyperbolic cotangent, 1 / tanh(x)sincthe normalized sinc function, sin(pi x) / (pi x), which is 1 at 0choosehow many ways there are to pick k things from n when order doesn’t matter (the binomial coefficient), exactremthe remainder of a divided by b, with the same sign as a, as C’s and JavaScript’s%give itnumeratorthe numerator of a fraction in lowest terms, or of a whole number itselfdenominatorthe denominator of a fraction in lowest terms, or 1 for a whole numberfrac_partthe part of x after the point, keeping its sign: frac_part(-2.25) is -0.25cfracx as a continued fraction, the list [a0, a1, a2, …] meaning a0 + 1/(a1 + 1/(a2 + …))to_fixedx as a fixed-point integer with int_bits whole bits and frac_bits fractional ones, rounded, shown in hexfloat_bitsthe bit pattern of x in a float format, shown in hexfloat_partsthe sign, exponent and mantissa fields of x as stored, as a mapnearest_floatx rounded to the nearest number a float format can storefloat_errorhow far x is from the nearest number a float format can store, as nearest minus xnormal_pdfthe probability density of a normal distribution at x, how likely values near x arenormal_cdfthe chance that a normal variable is at most xnormal_invthe value that a normal variable falls below with chance p, the reverse of normal_cdft_pdfthe probability density of a Student’s t distribution at x, how likely values near x aret_cdfthe chance that a Student’s t variable is at most xt_invthe value that a Student’s t variable falls below with chance p, the reverse of t_cdfchi2_pdfthe probability density of a chi-squared distribution at x, how likely values near x arechi2_cdfthe chance that a chi-squared variable is at most xchi2_invthe value that a chi-squared variable falls below with chance p, the reverse of chi2_cdff_pdfthe probability density of an F distribution at x, how likely values near x aref_cdfthe chance that an F variable is at most xf_invthe value that an F variable falls below with chance p, the reverse of f_cdfexp_pdfthe probability density of an exponential distribution at x, how likely values near x areexp_cdfthe chance that an exponential variable is at most xexp_invthe value that an exponential variable falls below with chance p, the reverse of exp_cdfgamma_pdfthe probability density of a gamma distribution at x, how likely values near x aregamma_cdfthe chance that a gamma variable is at most xgamma_invthe value that a gamma variable falls below with chance p, the reverse of gamma_cdfbeta_pdfthe probability density of a beta distribution at x, how likely values near x arebeta_cdfthe chance that a beta variable is at most xbeta_invthe value that a beta variable falls below with chance p, the reverse of beta_cdfweibull_pdfthe probability density of a Weibull distribution at x, how likely values near x areweibull_cdfthe chance that a Weibull variable is at most xweibull_invthe value that a Weibull variable falls below with chance p, the reverse of weibull_cdfcauchy_pdfthe probability density of a Cauchy distribution at x, how likely values near x arecauchy_cdfthe chance that a Cauchy variable is at most xcauchy_invthe value that a Cauchy variable falls below with chance p, the reverse of cauchy_cdflogistic_pdfthe probability density of a logistic distribution at x, how likely values near x arelogistic_cdfthe chance that a logistic variable is at most xlogistic_invthe value that a logistic variable falls below with chance p, the reverse of logistic_cdfpareto_pdfthe probability density of a Pareto distribution at x, how likely values near x arepareto_cdfthe chance that a Pareto variable is at most xpareto_invthe value that a Pareto variable falls below with chance p, the reverse of pareto_cdfrayleigh_pdfthe probability density of a Rayleigh distribution at x, how likely values near x arerayleigh_cdfthe chance that a Rayleigh variable is at most xrayleigh_invthe value that a Rayleigh variable falls below with chance p, the reverse of rayleigh_cdfbinom_invthe fewest successes in n tries with chance p each that are at least as likely as q to be reached, the reverse of binom_cdfpoisson_invthe fewest events that are at least as likely as q to be reached when rate are expected, the reverse of poisson_cdfrand_normala random number from a normal distribution with that mean and sd, or a list of n of themrand_expa random wait from an exponential distribution with that rate, or a list of n of themrand_poissona random event count from a Poisson distribution with that rate, or a list of n of themhexan integer in hex, the same asv to hexbinan integer in binary, the same asv to binoctan integer in octal, the same asv to octdecan integer in decimal, the same asv to decbasean integer in any base from 2 to 62, the same asv to base(b)base_tablea one-row table of an integer in binary, octal, decimal and hexfixedx as text with exactly that many decimals, padding with zeros if neededscix as text in scientific notation, like 1.23e5 for 123000, with digits decimalsengx as text in engineering notation, with the exponent a multiple of 3, like 123.457e6, with digits decimalsmixed_fraca number as a mixed fraction text, like “1 1/4” for 1.25, optionally rounded to the nearest 1/denpercenta fraction as percentage text, so 0.256 is “25.6%”, with digits decimalscommasx as text with commas between thousands, like “1,234,567”, with digits decimalsshort_scalea number as compact text with a short-scale word, like “2.5 million”human_bytesa number of bytes as text in the largest binary unit that fits, like “117.7 MiB”, with one decimaldmsan angle as degrees, arcminutes and arcseconds text, like 52°20′24″lata latitude in degrees as text with N or S, like 7°19′48″Slona longitude in degrees as text with E or W, like 74°0′21″Wranda random decimal from 0 up to but not including 1oddsa probability as “1 in N”, with a familiar event that’s about as likely, to give a feel for itrethe real partimthe imaginary part, as a plain numberconjthe complex conjugate: the same number with its imaginary part negatedargthe angle from the positive real axis to the number, as an angle unitcsqrtsquare root that gives a complex number for negatives, so csqrt(-4) is 2icrootsall n complex nth roots of a number, as a listpolarmake a complex number from its polar form, or with one argument show z in that formgammathe gamma function, which extends the factorial: gamma(n + 1) is n!, and it works between whole numbers toolgammathe natural log of the gamma function, which stays finite where gamma itself is too largebetathe beta function, gamma(a) × gamma(b) / gamma(a + b)erfthe error function: the chance a normal variable lands within x√2 standard deviations of its meanerfcthe complementary error function, 1 - erf(x), accurate even where that would round to 0digammathe digamma function, the slope of lgamma: the derivative of ln(gamma(x))zetathe Riemann zeta function, the sum of 1 / n^s over every whole number n from 1erf_invthe inverse of the error function: the x where erf(x) is y, for y between -1 and 1probitthe normal quantile: the z where a standard normal variable falls below z with chance pgamma_incthe regularized lower incomplete gamma function: the share of gamma(a) accumulated up to x, from 0 to 1beta_incthe regularized incomplete beta function: the share of beta(a, b) accumulated up to x, for x from 0 to 1sigmoidthe logistic curve 1 / (1 + e^-x): an S shape from 0 to 1logitthe inverse of sigmoid, ln(p / (1 - p)), for p between 0 and 1heavisidethe step function: 0 below zero, 1 above, and 1/2 at zerorampthe ramp function: 0 below zero, and x aboverectthe rectangle pulse: 1 for x within 1/2 of zero, 1/2 at the edges, 0 beyondtrithe triangle pulse: 1 at zero, falling in straight lines to 0 at 1 and -1dba ratio of two powers in decibels, as 10 × log10(ratio), so doubling is about +3 dBfrom_dbdecibels back to the ratio of powers, the reverse of dbgrowwhat money will be worth after time at the ratepresent_valuewhat a future sum, and any regular payments up to then, are worth today at the ratenpvthe net present value of a list of cash flows: each is discounted by the rate for every period since the first, which is nowloan_ratethe yearly rate of a loan from its monthly payment (the annual percentage rate, compounding monthly)depreciationa schedule of how an asset loses value over its life, a row per yearcagrthe steady yearly growth rate that would take start to end over time (compound annual growth rate)real_ratewhat a return is really worth once inflation is taken outpaymentthe monthly payment that pays off a loan over time, interest includedpayoffhow long a regular payment takes to pay off a balance with interest, rounded up to whole paymentsamortizea loan’s month-by-month schedulesharesplit a sum into parts, in equal shares or by the weights in a list, rounded to the cent so they still add up exactlychangehow much a value changed, as a fraction of where it startedmarginprofit as a fraction of the selling pricemarkupprofit as a fraction of what it cost yousunrisewhen the sun rises at a place on a day, or nil if it doesn’t rise or doesn’t set that daysunsetwhen the sun sets at a place on a day, or nil if it doesn’t rise or doesn’t set that dayday_lengthhow long the sun is up at a place on a day: 0 h if it never rises, 24 h if it never setsnearestthe city closest to a latitude and longitude, out of those zil knowsrgbmake a color from red, green and blue amounts (0-255), or give one argument to get a color’s three amountshslmake a color from hue, saturation and lightness, or give one argument to get a color’s three valuesram_latencythe 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.