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


Groups > comp.lang.fortran > #126593

Re: xkcd: Day Counter

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 14:30 -0700
Organization None to speak of
Message-ID <8734174vzu.fsf@example.invalid> (permalink)
References (1 earlier) <10qtr82$1f4di$2@dont-email.me> <87mrzhp0tt.fsf@example.invalid> <10qvg49$1t2f3$2@dont-email.me> <87bjfw4jq5.fsf@example.invalid> <10r147c$2c38c$1@dont-email.me>

Cross-posted to 4 groups.

Show all headers | View raw


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 */

Back to comp.lang.fortran | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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 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

csiph-web