#include "orsa_secure_math.h"#include "orsa_error.h"#include "support.h"#include <cmath>#include <iostream>Include dependency graph for orsa_secure_math.cc:

Go to the source code of this file.
Namespaces | |
| namespace | orsa |
Functions | |
| double | secure_pow (double x, double y) |
| double | secure_log (double x) |
| double | secure_log10 (double x) |
| double | secure_atan2 (double x, double y) |
| double | secure_asin (double x) |
| double | secure_acos (double x) |
| double | secure_sqrt (double x) |
|
|
Definition at line 99 of file orsa_secure_math.cc. References ORSA_DOMAIN_ERROR. Referenced by Orbit::Compute(), and Sky::Compute_J2000(). 00099 {
00100 if ((x>1.0) || (x<-1.0)) {
00101 // domain error
00102 ORSA_DOMAIN_ERROR("secure_acos(%g) is undefined!",x);
00103 return 1.0; // better value?
00104 } else {
00105 return acos(x);
00106 }
00107 }
|
|
|
Definition at line 88 of file orsa_secure_math.cc. References ORSA_DOMAIN_ERROR. 00088 {
00089 if ((x>1.0) || (x<-1.0)) {
00090 // domain error
00091 ORSA_DOMAIN_ERROR("secure_asin(%g) is undefined!",x);
00092 return 1.0; // better value?
00093 } else {
00094 return asin(x);
00095 }
00096 }
|
|
||||||||||||
|
Definition at line 73 of file orsa_secure_math.cc. References ORSA_DOMAIN_ERROR. Referenced by orsa::amph(), Orbit::Compute(), Sky::Compute_J2000(), OrbitWithCovarianceMatrixGSL::GenerateUsingCholeskyDecomposition(), OrbitWithCovarianceMatrixGSL::GenerateUsingPrincipalAxisTransformation(), and AstDySMatrixFile::Read(). 00073 {
00074 if (x==0.0) {
00075 if (y==0.0) {
00076 // domain error
00077 ORSA_DOMAIN_ERROR("secure_atan2(%g,%g) is undefined!",x,y);
00078 return 1.0; // better value?
00079 } else {
00080 return atan2(x,y);
00081 }
00082 } else {
00083 return atan2(x,y);
00084 }
00085 }
|
|
|
Definition at line 53 of file orsa_secure_math.cc. References ORSA_DOMAIN_ERROR. Referenced by Orbit::Compute(), and Orbit::RelativePosVel(). 00053 {
00054 if (x>0) {
00055 return log(x);
00056 } else {
00057 ORSA_DOMAIN_ERROR("secure_log(%g) is undefined!",x);
00058 return 1.0; // better value?
00059 }
00060 }
|
|
|
Definition at line 63 of file orsa_secure_math.cc. References ORSA_DOMAIN_ERROR. 00063 {
00064 if (x>0) {
00065 return log10(x);
00066 } else {
00067 ORSA_DOMAIN_ERROR("secure_log10(%g) is undefined!",x);
00068 return 1.0; // better value?
00069 }
00070 }
|
|
||||||||||||
|
Definition at line 38 of file orsa_secure_math.cc. References ORSA_DOMAIN_ERROR. Referenced by GalacticPotentialAllen::Acceleration(), orsa::Compute_Gauss(), orsa::ComputeAcceleration(), Orbit::GetE(), orsa::M1(), orsa::OrbitDifferentialCorrectionsLeastSquares(), orsa::poly_8(), orsa::poly_8_df(), orsa::poly_8_fdf(), GalacticPotentialAllen::PotentialEnergy(), and Units::Recompute(). 00038 {
00039
00040 if (x<0.0) {
00041 if (rint(y)!=y) {
00042 ORSA_DOMAIN_ERROR("secure_pow(%g,%g) is undefined!",x,y);
00043 return 1.0; // better value?
00044 } else {
00045 return pow(x,y);
00046 }
00047 } else {
00048 return pow(x,y);
00049 }
00050 }
|
|
|
Definition at line 110 of file orsa_secure_math.cc. References ORSA_DOMAIN_ERROR. Referenced by Orbit::Compute(), OrbitWithCovarianceMatrixGSL::GenerateUsingPrincipalAxisTransformation(), Orbit::Period(), Orbit::RelativePosVel(), and orsa::RMS_residuals(). 00110 {
00111 if (x<0) {
00112 // domain error
00113 ORSA_DOMAIN_ERROR("secure_sqrt(%g) is undefined!",x);
00114 return sqrt(fabs(x)); // better value?
00115 } else {
00116 return sqrt(x);
00117 }
00118 }
|
1.4.0