Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #123654 > unrolled thread

xkcd: Day Counter

Started byLynn McGuire <lynnmcguire5@gmail.com>
First post2026-04-03 22:40 -0500
Last post2026-04-06 14:40 +0000
Articles 9 on this page of 29 — 17 participants

Back to article view | Back to comp.lang.c++


Contents

  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 Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-04-04 22:09 +0000
            Re: xkcd: Day Counter Nioclás Pól Caileán de Ghloucester <thanks-to@Taf.com> - 2026-04-05 12:50 +0000
              Re: xkcd: Day Counter Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-04-05 20:40 +0000
                Re: xkcd: Day Counter Nioclás Pól Caileán de Ghloucester <thanks-to@Taf.com> - 2026-04-05 23:06 +0000
                  Re: xkcd: Day Counter Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-04-06 01:36 +0000
              Re: xkcd: Day Counter Louis Krupp <lkrupp@invalid.pssw.com.invalid> - 2026-04-06 16:03 -0600
            Re: xkcd: Day Counter Nioclás Pól Caileán de Ghloucester <thanks-to@Taf.com> - 2026-04-08 18:20 +0000
            Re: xkcd: Day Counter Cóilín Nioclásín Glostéir <thanks-to@Taf.com> - 2026-08-21 18:45 +0000
          Re: xkcd: Day Counter Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-08-22 04:14 +0800
      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 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 Nioclás Pól Caileán de Ghloucester <thanks-to@Taf.com> - 2026-04-06 15:54 +0000
            Re: xkcd: Day Counter Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-04-06 20:40 +0000
              Re: xkcd: Day Counter "J-P. Rosen" <rosen@adalog.fr> - 2026-04-07 07:48 +0200
    Re: xkcd: Day Counter candycanearter07 <candycanearter07@candycanearter07.nomail.afraid> - 2026-04-06 14:40 +0000

Page 2 of 2 — ← Prev page 1 [2]


#123666

FromKeith Thompson <Keith.S.Thompson+u@gmail.com>
Date2026-04-05 14:13 -0700
Message-ID<87mrzhp0tt.fsf@example.invalid>
In reply to#123664
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.

[...]

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */

[toc] | [prev] | [next] | [standalone]


#123669

FromThomas Koenig <tkoenig@netcologne.de>
Date2026-04-06 05:25 +0000
Message-ID<10qvg49$1t2f3$2@dont-email.me>
In reply to#123666
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.

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

[toc] | [prev] | [next] | [standalone]


#123670

FromKeith Thompson <Keith.S.Thompson+u@gmail.com>
Date2026-04-06 00:43 -0700
Message-ID<87bjfw4jq5.fsf@example.invalid>
In reply to#123669
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 */

[toc] | [prev] | [next] | [standalone]


#123680

FromThomas Koenig <tkoenig@netcologne.de>
Date2026-04-06 20:14 +0000
Message-ID<10r147c$2c38c$1@dont-email.me>
In reply to#123670
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.

[toc] | [prev] | [next] | [standalone]


#123682

FromKeith Thompson <Keith.S.Thompson+u@gmail.com>
Date2026-04-06 14:30 -0700
Message-ID<8734174vzu.fsf@example.invalid>
In reply to#123680
Thomas Koenig <tkoenig@netcologne.de> writes:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> schrieb:
>> Thomas Koenig <tkoenig@netcologne.de> writes:
[...]
>>> 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.

You can do that in C or C++ too, though not as cleanly.  With a
series of #if directives, you can select the minimal floating-point
type (out of float, double, long double) that satisfies some
requirement.  But I don't recall ever seeing code that does this.

This is rapidly going off-topic for most of the newsgroups this is
posted to, so I won't go into more detail.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */

[toc] | [prev] | [next] | [standalone]


#123674

FromNioclás Pól Caileán de Ghloucester <thanks-to@Taf.com>
Date2026-04-06 15:54 +0000
Message-ID<10r0l0d$1usiv$1@paganini.bofh.team>
In reply to#123669
Thomas Koenig <tkoenig@NetCologne.De> hat geschrieben:
|-------------------------------------------------------------------|
|"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."                                            |
|-------------------------------------------------------------------|

I recommend using Ada instead.
(S. HTTP://Gloucester.Insomnia247.NL/ fuer Kontaktdaten!)

[toc] | [prev] | [next] | [standalone]


#123681

FromLawrence D’Oliveiro <ldo@nz.invalid>
Date2026-04-06 20:40 +0000
Message-ID<10r15nd$2c976$3@dont-email.me>
In reply to#123674
On Mon, 6 Apr 2026 15:54:55 -0000 (UTC), Nioclás Pól Caileán de
Ghloucester wrote:

> I recommend using Ada instead.

Unless Ada offers the option for decimal arithmetic, that’s not likely
to help.

[toc] | [prev] | [next] | [standalone]


#123686

From"J-P. Rosen" <rosen@adalog.fr>
Date2026-04-07 07:48 +0200
Message-ID<10r25qf$2jvj1$1@dont-email.me>
In reply to#123681
Le 06/04/2026 à 22:40, Lawrence D’Oliveiro a écrit :
 > On Mon, 6 Apr 2026 15:54:55 -0000 (UTC), Nioclás Pól Caileán de
 > Ghloucester wrote:
 >
 >> I recommend using Ada instead.
 >
 > Unless Ada offers the option for decimal arithmetic, that’s not likely
 > to help.??
Ada HAS decimal arithmetic, with specifiable accuracy, as well as 
floating point arithmetic, with specifiable accuracy.
In addition, the guarantee of accuracy extends to the whole mathematical 
library (with the Numerics annex)

[toc] | [prev] | [next] | [standalone]


#123672

Fromcandycanearter07 <candycanearter07@candycanearter07.nomail.afraid>
Date2026-04-06 14:40 +0000
Message-ID<slrn10t7h7v.gdt2.candycanearter07@candydeb.host.invalid>
In reply to#123654
Lynn McGuire <lynnmcguire5@gmail.com> wrote at 03:40 this Saturday (GMT):
> 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.
>
> Explained at:
>     https://www.explainxkcd.com/wiki/index.php/3228:_Day_Counter
>
> Whatever you do, do not select “Space Opera Mode” in the new mode drop 
> down list.  "Boat mode" made me a little queasy after a while.  And 
> "modem mode" does not seem to do anything.
>
> Lynn


I think modem mode actually slows down the transfer rate, cute idea but
it freezes my browser. Boat Mode is pretty nostalgic tho, reminds me of
WaveHello :)
-- 
user <candycane> is generated from /dev/urandom

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.c++


csiph-web