Re: xkcd: Day Counter

Liste des GroupesRevenir à cl c++ 
Sujet : Re: xkcd: Day Counter
De : tkoenig (at) *nospam* netcologne.de (Thomas Koenig)
Groupes : rec.arts.sf.written rec.arts.comics.strips comp.lang.fortran comp.lang.c++
Date : 06. Apr 2026, 21:14:36
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <10r147c$2c38c$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : slrn/1.0.3 (Linux)
Keith Thompson <Keith.S.Thompson+u@gmail.com> schrieb:
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

Not quite the same.  SELECTED_REAL_KIND gives you the
_minimum_ real type for your requirements.

--
This USENET posting was made without artificial intelligence,
artificial impertinence, artificial arrogance, artificial stupidity,
artificial flavorings or artificial colorants.

Date Sujet#  Auteur
4 Apr 26 * xkcd: Day Counter26Lynn McGuire
4 Apr 26 +* Re: xkcd: Day Counter12Your Name
4 Apr 26 i+* Re: xkcd: Day Counter8Lawrence D’Oliveiro
4 Apr 26 ii`* Re: xkcd: Day Counter7Nioclás Pól Caileán de Ghloucester
4 Apr 26 ii `* Re: xkcd: Day Counter6Lawrence D’Oliveiro
5 Apr 26 ii  +* Re: xkcd: Day Counter4Nioclás Pól Caileán de Ghloucester
5 Apr 26 ii  i`* Re: xkcd: Day Counter3Lawrence D’Oliveiro
6 Apr 26 ii  i `* Re: xkcd: Day Counter2Nioclás Pól Caileán de Ghloucester
6 Apr 26 ii  i  `- Re: xkcd: Day Counter1Lawrence D’Oliveiro
8 Apr 26 ii  `- Re: xkcd: Day Counter1Nioclás Pól Caileán de Ghloucester
4 Apr 26 i+- Re: xkcd: Day Counter1Paul S Person
6 Apr 26 i`* Re: xkcd: Day Counter2Stuart Redmann
6 Apr 26 i `- Re: xkcd: Day Counter1Paul S Person
4 Apr 26 +* Re: xkcd: Day Counter2Tony Nance
4 Apr 26 i`- Re: xkcd: Day Counter1Mark Jackson
4 Apr 26 +- Re: xkcd: Day Counter1Jay Morris
5 Apr 26 +* Re: xkcd: Day Counter9Chris Ahlstrom
5 Apr 26 i`* Re: xkcd: Day Counter8Keith Thompson
6 Apr 26 i `* Re: xkcd: Day Counter7Thomas Koenig
6 Apr 26 i  +* Re: xkcd: Day Counter3Keith Thompson
6 Apr 26 i  i`* Re: xkcd: Day Counter2Thomas Koenig
6 Apr 26 i  i `- Re: xkcd: Day Counter1Keith Thompson
6 Apr 26 i  `* Re: xkcd: Day Counter3Nioclás Pól Caileán de Ghloucester
6 Apr 26 i   `* Re: xkcd: Day Counter2Lawrence D’Oliveiro
7 Apr 26 i    `- Re: xkcd: Day Counter1J-P. Rosen
6 Apr 26 `- Re: xkcd: Day Counter1candycanearter07

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal