gnuastro-devel
[Top][All Lists]
Advanced

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

[task #15567] Converting hh:mm:ss and dd:mm:ss notations to degrees and


From: Mohammad Akhlaghi
Subject: [task #15567] Converting hh:mm:ss and dd:mm:ss notations to degrees and vice vesa
Date: Mon, 16 Mar 2020 20:33:29 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0

Follow-up Comment #13, task #15567 (project gnuastro):

Sorry! I forgot to clarify another point: since the parsing function may fail
to parse the string, as you have done, it is often necessary to call it with
an `if' statement. Its value is also not returned, but written into the
argument array. 

You can thus use these two points for the benefit of the readability of your
code! Notice how in my implementation it just returns an integer. The returned
value is 1 if it succeeds and 0 if it fails. So you can call it simply like
this:


if(gal_units_extract_decimal(convert, val))
 ....
else
 ....


The statement you had used (below) is very confusing: its returning the
opposite of true (0) to be true!


if (gal_units_extract_decimal (convert, val) == 0)


I hope this helps in writing a good code ;-).

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/task/?15567>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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