subsurface/core
Berthold Stoeger a748e7f239 Unify float calulations: use double
Internal floating point (FP) calculations should be performed using double
unless there is a very good reason. This avoids headaches with conversions.
Indeed, the vast majority of FP calculations were already done using double.
This patch adapts most remaining calculations. Not converted where things
that were based on binary representations and variables which weren't used
anyway.

An analysis of all instances follows:

core/plannernotes.c, l.404:

This was a comparison between two floats. On the left side, first an integer
was cast to float then multiplied with and integer and divided by a constant
double. The right hand side was an integer cast to a float. Simply divide by
1000.0 first to convert to double and continue with calculations. On the right
hand side, remove the cast, because the integer will be implicitely cast to
double for comparison. This conversion actually emits less instructions,
because no conversion to double and back is performed.

core/planner.c, l.613:

Same analysis as previous case.

subsurface-desktop-main.cpp, l.155:

A local variable representing the version OpenGL version. Turn this into
integer logic. Not only does this avoid dreaded FP rounding issues, it also
works correctly for minor version > 10 (not that such a thing is to be
expected anytime soon).

abstractpreferenceswidget.[h/cpp]:

A widget where the position is described as a float. Turn into double.

desktop-widgets/divelogexportdialog.cpp, l.313:

total_weight is described as float. Use double arithmetics instead. This
instance fixes a truncation warning emitted by gcc.
2017-12-17 09:02:44 -08:00
..
subsurface-qt Fix crash when dives have no dive site 2017-11-25 08:19:47 -08:00
android.cpp win32: optimize the console and logging logic 2017-11-03 07:49:11 -07:00
btdiscovery.cpp Show BT device names first 2017-12-07 18:15:40 +01:00
btdiscovery.h mobile: enable switching BT on/off during session. 2017-10-12 09:43:40 +02:00
checkcloudconnection.cpp Allocate CheckCloudConnection object on stack 2017-12-06 02:23:47 +01:00
checkcloudconnection.h Remove self-include of core/checkcloudconnection.h 2017-12-06 02:23:47 +01:00
cloudstorage.cpp Constify strings in pref.h 2017-11-18 21:57:33 +01:00
cloudstorage.h Remove bogus member that hides global variable 2017-10-26 20:44:02 +02:00
CMakeLists.txt Cleanup: rename file to avoid confusion 2017-12-08 16:29:49 +01:00
cochran.c Start cleaning up sensor indexing for multiple sensors 2017-07-21 16:33:19 -07:00
cochran.h Cochran import: better support for older models 2017-05-31 21:53:00 -07:00
color.cpp Display gas density instead of SAC in planner 2017-05-26 15:52:04 -07:00
color.h Display gas density instead of SAC in planner 2017-05-26 15:52:04 -07:00
compressibility.r Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
configuredivecomputer.cpp Save Subsurface version to libdivecomputer logfile 2017-09-28 08:51:34 +02:00
configuredivecomputer.h Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
configuredivecomputerthreads.cpp Fix typo: LENGHT -> LENGTH 2017-11-17 15:29:42 +01:00
configuredivecomputerthreads.h Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
connectionlistmodel.cpp Add function to clear connectionModel data 2017-10-12 09:32:12 +02:00
connectionlistmodel.h Add function to clear connectionModel data 2017-10-12 09:32:12 +02:00
datatrak.c datatrak.c: don't use POSIX %m format for sscanf() in dtrak_prepare_data() 2017-06-11 15:56:41 -07:00
datatrak.h Datatrak import rework: Add another memory size ckeck 2017-05-07 07:48:12 -07:00
deco.c Remove unnecessary #include and correct whitespace 2017-12-01 15:47:51 -08:00
deco.h Localize global planner state 2017-11-25 20:13:01 +01:00
device.c Init every struct sample with default values 2017-11-13 20:50:10 -08:00
device.h Add SPDX header to core C files 2017-04-29 13:32:55 -07:00
devicedetails.cpp Implement OSTC4 specific settings 2017-05-04 10:50:15 -07:00
devicedetails.h Implement OSTC4 specific settings 2017-05-04 10:50:15 -07:00
display.h Display values in info box only if value is interesting 2017-11-13 20:50:10 -08:00
dive.c Enable removal of pictures from different dives at the same moment 2017-12-13 05:48:20 -08:00
dive.h Enable removal of pictures from different dives at the same moment 2017-12-13 05:48:20 -08:00
divecomputer.cpp Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
divecomputer.h Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
divelist.c Localize global planner state 2017-11-25 20:13:01 +01:00
divelist.h Localize global planner state 2017-11-25 20:13:01 +01:00
divelogexportlogic.cpp Creation of dive duration string and surface interval string 2017-05-26 15:50:52 -07:00
divelogexportlogic.h Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
divesite-helper.cpp Cleanup: rename file to avoid confusion 2017-12-08 16:29:49 +01:00
divesite.c divesite.c: use NULL instead of 0 for char* buffers 2017-10-05 12:06:13 -07:00
divesite.h Tags for geo references: Nicer look, translations and warning message 2017-10-17 06:12:07 -04:00
divesitehelpers.cpp Reverse geo lookup string for http://api.geonames.org corrected 2017-10-16 03:43:02 -08:00
divesitehelpers.h Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
downloadfromdcthread.cpp Add debug output for vendor/product tuples 2017-12-02 18:14:23 -08:00
downloadfromdcthread.h Make Bluetooth naming consistent 2017-11-13 20:48:17 -08:00
equipment.c Code cleanup: Move index declarations into for loop 2017-11-27 22:40:16 +01:00
errorhelper.c Set error callback helper 2017-10-26 14:37:39 +02:00
exif.cpp Image import: Make Exif handling more tolerant, better info,... 2017-05-06 08:07:16 -07:00
exif.h Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
file.c Remove function isCloudUrl() 2017-12-14 17:01:05 +01:00
file.h Datatrak import rework: changes of file.c and file.h 2017-05-07 07:48:12 -07:00
gas-model.c Compute and display gas density 2017-05-26 15:52:04 -07:00
gaspressures.c Properly declare 'has_gaschange_event()' function 2017-11-17 15:25:26 +01:00
gaspressures.h Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
gettext.h Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
gettextfromc.cpp Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
gettextfromc.h Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
git-access.c Gracefully handle cloud authentication failure in verbose mode 2017-12-05 11:31:39 -08:00
git-access.h Clean up git storage update messages 2017-06-18 01:00:30 -07:00
gpslocation.cpp applying gps fixes: group repetitive code under a macro 2017-12-13 05:07:15 -08:00
gpslocation.h Mobile: honour location service time threshold 2017-07-25 22:12:19 +09:00
helpers.h Creation of dive duration string and surface interval string 2017-05-26 15:50:52 -07:00
imagedownloader.cpp Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
imagedownloader.h Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
import-cobalt.c Move Cobalt DB import to its own file 2017-11-29 01:22:17 +01:00
import-divinglog.c Move Divinglog DB import into its own file 2017-11-29 01:22:17 +01:00
import-shearwater.c Move Shearwater DB import into its own file 2017-11-29 01:22:17 +01:00
import-suunto.c Move Suunto DB import into its own file 2017-11-29 01:22:17 +01:00
isocialnetworkintegration.cpp Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
isocialnetworkintegration.h Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
libdivecomputer.c Add pSCR divemode detection 2017-12-13 05:03:36 -08:00
libdivecomputer.h QML UI: add dev_info data to AppLog 2017-07-09 12:50:22 -07:00
linux.c Clean up system_default_filename() 2017-11-22 19:22:29 +01:00
liquivision.c Safeguards for Liquivision import 2017-10-07 08:36:10 -07:00
load-git.c Store and load the planner related depth info of a cylinder in logfile 2017-11-27 11:49:08 -08:00
macos.c Clean up system_default_filename() 2017-11-22 19:22:29 +01:00
membuffer.c Fix crash when text empty 2017-10-08 19:41:54 +03:00
membuffer.h Refactore parse-xml.c into parse.c and parse-xml.c 2017-11-27 13:42:10 -08:00
metrics.cpp Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
metrics.h Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
ostctools.c Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
parse-xml.c Move Cobalt and Divinglog DB parsing to parse-db.c 2017-11-27 13:42:10 -08:00
parse.c Remove commented out code 2017-11-29 01:22:17 +01:00
parse.h Move atoi_n to parse.c 2017-11-27 13:42:10 -08:00
planner.c Unify float calulations: use double 2017-12-17 09:02:44 -08:00
planner.h Move planner notes to separate file 2017-05-26 15:44:36 -07:00
plannernotes.c Unify float calulations: use double 2017-12-17 09:02:44 -08:00
pluginmanager.cpp Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
pluginmanager.h Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
pref.h Fix ownership issues in preferences code 2017-11-25 07:41:09 -08:00
prefs-macros.h Fix ownership issues in preferences code 2017-11-25 07:41:09 -08:00
profile.c Fix signed/unsigned issue 2017-11-29 14:56:39 -08:00
profile.h Hand planner variables to profile 2017-11-25 20:13:01 +01:00
qt-ble.cpp Better error message on BLE connection timeout 2017-11-13 20:44:26 -08:00
qt-ble.h iOS build: need to more includes 2017-07-19 06:21:23 -07:00
qt-gui.h Remove dead code 2017-11-19 12:20:43 -08:00
qt-init.cpp Don't show localization warning unless verbose 2017-10-20 06:51:51 -04:00
qthelper.cpp Remove function isCloudUrl() 2017-12-14 17:01:05 +01:00
qthelper.h Localize global planner state 2017-11-25 20:13:01 +01:00
qthelperfromc.h Remove function isCloudUrl() 2017-12-14 17:01:05 +01:00
qtserialbluetooth.cpp Fix typo: successfull -> successful and succesfully -> successfully 2017-11-20 10:01:15 +01:00
save-git.c Store and load the planner related depth info of a cylinder in logfile 2017-11-27 11:49:08 -08:00
save-html.c Unify sample pressure and o2pressure as pressure[2] array 2017-07-20 17:32:54 -07:00
save-html.h Add SPDX header to core C files 2017-04-29 13:32:55 -07:00
save-xml.c Store and load the planner related depth info of a cylinder in logfile 2017-11-27 11:49:08 -08:00
serial_ftdi.c Update to the latest libdc version 2017-12-12 21:16:19 -08:00
sha1.c Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
sha1.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
statistics.c Mark missing translations 2017-10-29 20:00:53 +01:00
statistics.h Creation of dive duration string and surface interval string 2017-05-26 15:50:52 -07:00
strndup.h Add SPDX header to core C files 2017-04-29 13:32:55 -07:00
strtod.c Add SPDX header to core C files 2017-04-29 13:32:55 -07:00
subsurfacestartup.c location service: reduce default thresholds 2017-12-10 11:38:19 -08:00
subsurfacestartup.h Fix ownership issues in preferences code 2017-11-25 07:41:09 -08:00
subsurfacesysinfo.cpp Random whitespace cleanup 2017-05-27 11:07:20 -07:00
subsurfacesysinfo.h Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
taxonomy.c Fix two bugs in taxonomy_set_country 2017-10-07 08:16:53 -07:00
taxonomy.h Add taxonomy helper functions 2017-10-04 08:05:09 -07:00
time.c Add SPDX header to core C files 2017-04-29 13:32:55 -07:00
uemis-downloader.c Resolve type confusion 2017-07-17 16:50:03 -07:00
uemis.c Start cleaning up sensor indexing for multiple sensors 2017-07-21 16:33:19 -07:00
uemis.h Add SPDX header to core C files 2017-04-29 13:32:55 -07:00
units.h Change prefs.show_units_table to bool 2017-11-24 07:56:10 -08:00
version.c Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
version.h Move subsurface-core to core and qt-mobile to mobile-widgets 2016-04-04 22:33:58 -07:00
webservice.h Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
windows.c Clean up system_default_filename() 2017-11-22 19:22:29 +01:00
windowtitleupdate.cpp Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
windowtitleupdate.h Add SPDX header to remaining core files 2017-04-29 13:32:55 -07:00
worldmap-options.h Add SPDX header to core C files 2017-04-29 13:32:55 -07:00
worldmap-save.c worldmap-save: don't use an API key 2017-07-30 16:28:30 -07:00
worldmap-save.h Add SPDX header to core C files 2017-04-29 13:32:55 -07:00