Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes arccos evaluating double close to -1 or 1 #4405

Merged
merged 3 commits into from
Apr 19, 2021

Conversation

acpaquette
Copy link
Collaborator

@acpaquette acpaquette commented Apr 16, 2021

Fixed issue where the acos of -1.0000000001 was resulting in a nan

Description

Fixes an issue in caminfo where we apply arccos to another trigonometric expression that results in a double. Sometimes the result should be -1 or 1 but due to double precision accuracy it results in something extremely close to those values eg. acos(-1.000000000001). This is an inelegant solution but solves the problem in caminfo.

Related Issue

Closes #4393

Motivation and Context

ISIS 5.0.1 Support Sprint

How Has This Been Tested?

Tested manually through caminfo/campt

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Documentation change (update to the documentation; no code change)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read and agree to abide by the Code of Conduct
  • I have read the CONTRIBUTING document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have added myself to the .zenodo.json document.
  • I have added any user impacting changes to the CHANGELOG.md document.

Licensing

This project is mostly composed of free and unencumbered software released into the public domain, and we are unlikely to accept contributions that are not also released into the public domain. Somewhere near the top of each file should have these words:

This work is free and unencumbered software released into the public domain. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain.

  • I dedicate any and all copyright interest in this software to the public domain. I make this dedication for the benefit of the public at large and to the detriment of my heirs and successors. I intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

@acpaquette acpaquette requested a review from dpmayerUSGS April 16, 2021 20:57
isis/src/base/objs/Camera/Camera.cpp Outdated Show resolved Hide resolved
dpmayerUSGS
dpmayerUSGS previously approved these changes Apr 16, 2021
Copy link

@dpmayerUSGS dpmayerUSGS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intermediate sounds good to me as a variable name. The if/else logic to clamp intermediate values within the [-1,1] interval looks correct to me.

@acpaquette acpaquette merged commit 84b0ec6 into DOI-USGS:dev Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected "nan" in caminfo output
3 participants