HPL_dlamch(3)
π HPL_dlamch β it's giving machine-constants energy π
okay bestie, welcome to HPL_dlamch(3), straight out of the HPL Library Functions collection. this one's a little diva that pulls machine-specific arithmetic constants out of thin air (well, out of your hardware). let's get into it π«Ά
β¨ NAME β¨
HPL_dlamch β determines machine-specific arithmetic constants. that's it, that's the job, and she does it flawlessly π
πΈ SYNOPSIS πΈ
#include "hpl.h"
double HPL_dlamch( const HPL_T_MACH CMACH );
π¦ DESCRIPTION π¦
so like, HPL_dlamch determines machine-specific arithmetic constants. we're talking the relative machine precision (eps), the safe minimum (sfmin) β and bestie, the whole point of sfmin is that 1 / sfmin does not overflow, iconic β the base of the machine (base), the precision (prec), the number of (base) digits in the mantissa (t), whether rounding occurs in addition (rnd=1.0, and 0.0 otherwise, no in-between, we don't do nuance), the minimum exponent before (gradual) underflow (emin), the underflow threshold (rmin) which is base**(emin-1), the largest exponent before overflow (emax), and the overflow threshold (rmax) which is (base**emax)*(1-eps).
literally a whole glow-up for your floating-point math π
π ARGUMENTS π
CMACHβ (local input)const HPL_T_MACH. this lil parameter specifies the value to be returned byHPL_dlamch, and honestly she's the main character:= HPL_MACH_EPS,HPL_dlamch := eps(default β the vibe when you don't specify)= HPL_MACH_SFMIN,HPL_dlamch := sfmin= HPL_MACH_BASE,HPL_dlamch := base= HPL_MACH_PREC,HPL_dlamch := eps*base= HPL_MACH_MLEN,HPL_dlamch := t= HPL_MACH_RND,HPL_dlamch := rnd= HPL_MACH_EMIN,HPL_dlamch := emin= HPL_MACH_RMIN,HPL_dlamch := rmin= HPL_MACH_EMAX,HPL_dlamch := emax= HPL_MACH_RMAX,HPL_dlamch := rmax
where, for the girlies keeping score at home:
eps= relative machine precision,sfmin= safe minimum,base= base of the machine,prec=eps*base,t= number of digits in the mantissa,rnd=1.0if rounding occurs in addition,emin= minimum exponent before underflow,rmin= underflow threshold,emax= largest exponent before overflow,rmax= overflow threshold.
π EXAMPLE π
look at her go, a whole working program, periodt:
#include "hpl.h"
int main(int argc, char *argv[])
{
double eps;
eps = HPL_dlamch( HPL_MACH_EPS );
printf("eps=%18.8e\n", eps);
exit(0); return(0);
}
π REFERENCES π
ngl this function has lore. it was manually translated from the Fortran 77 LAPACK auxiliary function dlamch.f (version 2.0 -- 1992), which was itself based on the function ENVRON by Malcolm, and it incorporated suggestions by Gentleman and Marovich. see:
- Malcolm M. A., Algorithms to reveal properties of floating-point arithmetic., Comms. of the ACM, 15, 949-951 (1972).
- Gentleman W. M. and Marovich S. B., More on algorithms that reveal properties of floating point arithmetic units., Comms. of the ACM, 17, 276-277 (1974).
fr fr, the math here is real and the translation is faithful β treat these constants with the respect they deserve π
HPL 2.2 Β· February 24, 2016 β okay that's the whole page bestie, go forth and compute your machine constants, slay β¨ππ¦πΈπ π«Ά
π¦ where this page comes from
- fedora 43: hpl-doc 2.2-22.fc43 Β· LicenseRef-Callaway-BSD-with-advertising
- fedora 44: hpl-doc 2.2-23.fc44 Β· LicenseRef-Callaway-BSD-with-advertising
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms