[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 53f0cfa: CosmicCalculator: redshift zero reque

From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 53f0cfa: CosmicCalculator: redshift zero request is converted to 1e-14
Date: Fri, 10 May 2019 09:39:18 -0400 (EDT)

branch: master
commit 53f0cfaff06793bb85d8051edb14ba782e27598a
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    CosmicCalculator: redshift zero request is converted to 1e-14
    Until now, CosmicCalculator would fail when given a value of zero with this
    GSL error: "gsl: qng.c:189: ERROR: failed to reach tolerance with
    highest-order rule". So its numerical integration would fail to converge.
    To fix the problem, with this commit, when the user requests results for
    z=0, we internally convert it to `1e-14' (close to, but not exactly, the
    64-bit floating point precision limit).
    This bug was reported by Leindert Boogaard.
    This fixes bug #56299.
 NEWS                         | 1 +
 bin/cosmiccal/ui.c           | 7 +++++++
 doc/announce-acknowledge.txt | 1 +
 3 files changed, 9 insertions(+)

diff --git a/NEWS b/NEWS
index 3e67c9a..9eec5f9 100644
--- a/NEWS
+++ b/NEWS
@@ -40,6 +40,7 @@ See the end of the file for license conditions.
   bug #56246: Single-valued measurement must abort with no value in Statistics.
   bug #56256: Segmentation fault when reading plain text array/image.
   bug #56257: ConvertType: Values not preserved when converting text to FITS.
+  bug #56299: cosmiccal fails at z=0.
diff --git a/bin/cosmiccal/ui.c b/bin/cosmiccal/ui.c
index e52842b..192f6fc 100644
--- a/bin/cosmiccal/ui.c
+++ b/bin/cosmiccal/ui.c
@@ -263,6 +263,13 @@ ui_read_check_only_options(struct cosmiccalparams *p)
           "The cosmological constant (`olambda'), matter (`omatter') "
           "and radiation (`oradiation') densities are given as %.8f, %.8f, "
           "%.8f", sum, p->olambda, p->omatter, p->oradiation);
+  /* Currently GSL will fail for z=0. So if a value of zero is given (bug
+     #56299). As a work-around, in such cases, we'll change it to 1e-14
+     (close to, but not exactly, the 64-bit floating point precision
+     limit). GSL will do the integration without any error with this
+     value. */
+  if(p->redshift==0.0f) p->redshift=1e-14;
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index 8a0b5cc..53e78c9 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -1,5 +1,6 @@
 Alphabetically ordered list to acknowledge in the next release.
+Leindert Boogaard
 Raul Infante-Sainz
 Lee Kelvin
 David Valls-Gabaud

reply via email to

[Prev in Thread] Current Thread [Next in Thread]