Groups | Search | Server Info | Login | Register
Groups > rec.arts.sf.written > #655827
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Newsgroups | rec.arts.sf.written, rec.arts.comics.strips, comp.lang.fortran, comp.lang.c++ |
| Subject | Re: xkcd: Day Counter |
| Date | 2026-04-06 00:43 -0700 |
| Organization | None to speak of |
| Message-ID | <87bjfw4jq5.fsf@example.invalid> (permalink) |
| References | <10qq170$d49s$2@dont-email.me> <10qtr82$1f4di$2@dont-email.me> <87mrzhp0tt.fsf@example.invalid> <10qvg49$1t2f3$2@dont-email.me> |
Cross-posted to 4 groups.
Thomas Koenig <tkoenig@netcologne.de> writes:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> schrieb:
>> Chris Ahlstrom <OFeem1987@teleworm.us> writes:
>>> Lynn McGuire wrote this screed in ALL-CAPS:
>>>> xkcd: Day Counter
>>>> https://xkcd.com/3228/
>>>>
>>>> Yes, floating point errors are the bane of my life ! Not so much now
>>>> with double precision but the single precision days were nightmares.
>>>
>>> Well these days we have long double.
>>
>> C has had long double as a standard type since the original 1989
>> ANSI C standard. (K&R1, 1978, didn't have long double.)
>>
>> But wider floating-point types don't eliminate rounding errors.
>
> Nor does "long double" have to be any more accurate thean
> "double". C's type system leaves something to be desired
> in that respect.
>
> Fortran showed how it's done with its kind numbers and
> SELECTED_REAL_KIND function - you ask for a certain minimum
> precision, and the compiler either gives it to you, or your program
> fails at compile time.
You can do the same thing in C or C++ with a compile-time test.
#include <float.h>
#if LDBL_DIG < 18
#error "long double doesn't have enough precision"
#endif
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Back to rec.arts.sf.written | Previous | Next — Previous in thread | Next in thread | Find similar
xkcd: Day Counter Lynn McGuire <lynnmcguire5@gmail.com> - 2026-04-03 22:40 -0500
Re: xkcd: Day Counter Your Name <YourName@YourISP.com> - 2026-04-04 16:46 +1300
Re: xkcd: Day Counter Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-04-04 07:40 +0000
Re: xkcd: Day Counter Nioclás Pól Caileán de Ghloucester <thanks-to@Taf.com> - 2026-04-04 16:19 +0000
Re: xkcd: Day Counter Paul S Person <psperson@old.netcom.invalid> - 2026-04-04 09:16 -0700
Re: xkcd: Day Counter Stuart Redmann <DerTopper@web.de> - 2026-04-06 16:10 +0200
Re: xkcd: Day Counter Paul S Person <psperson@old.netcom.invalid> - 2026-04-06 08:33 -0700
Re: xkcd: Day Counter R Daneel Olivaw <Danni@hyperspace.vogon.gov.invalid> - 2026-04-04 10:55 +0200
Re: xkcd: Day Counter Paul S Person <psperson@old.netcom.invalid> - 2026-04-04 09:25 -0700
Re: xkcd: Day Counter Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-04-04 22:21 +0000
Re: xkcd: Day Counter Tony Nance <tnusenet17@gmail.com> - 2026-04-04 10:40 -0400
Re: xkcd: Day Counter Mark Jackson <mjackson@alumni.caltech.edu> - 2026-04-04 11:01 -0400
Re: xkcd: Day Counter Jay Morris <morrisj@epsilon3.me> - 2026-04-04 11:44 -0500
Re: xkcd: Day Counter Chris Ahlstrom <OFeem1987@teleworm.us> - 2026-04-05 10:22 -0400
Re: xkcd: Day Counter Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-04-05 14:13 -0700
Re: xkcd: Day Counter Thomas Koenig <tkoenig@netcologne.de> - 2026-04-06 05:25 +0000
Re: xkcd: Day Counter Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-04-06 00:43 -0700
Re: xkcd: Day Counter Thomas Koenig <tkoenig@netcologne.de> - 2026-04-06 20:14 +0000
Re: xkcd: Day Counter Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-04-06 14:30 -0700
Re: xkcd: Day Counter candycanearter07 <candycanearter07@candycanearter07.nomail.afraid> - 2026-04-06 14:40 +0000
csiph-web