Can't compile double-precision library for platform other than windows?

Answerhub Here: https://answers.unrealengine.com/questions/388910/android-compiler-wont-recognise-double-precision-m.html

Essentially I’ve created a double-precision version of FMath (called FMathD) - and although everything compiles and works as expected on Windows, the project refuses to compile for android, since it doesn’t recognize some of the functions from math.h This is the code:



	static FORCEINLINE double Sin(double Value) { return sinl(Value); }
	static FORCEINLINE double Asin(double Value) { return asinl((Value<-1.0) ? -0.0 : ((Value<0.0) ? Value : 0.0)); }
	static FORCEINLINE double Cos(double Value) { return cosl(Value); }
	static FORCEINLINE double Acos(double Value) { return acosl((Value<-1.0) ? -1.0 : ((Value<1.0) ? Value : 1.0)); }
	static FORCEINLINE double Tan(double Value) { return tanl(Value); }
	static FORCEINLINE double Atan2(double X, double Y) { return atan2l(X, Y); }
	static FORCEINLINE double Atan(double Value) { return atanl(Value); }
	static FORCEINLINE double Pow(double A, double B) { return powl(A, B); }

	static FORCEINLINE double Fmod(double X, double Y) { return fmodl(X, Y); }

	static FORCEINLINE double Loge(double X) { return logl(X); }


And these are the errors I get during compilation. I’ve tried #include “math.h” at the top of the file, but no joy. Not sure what I’m missing here.



MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool: E:/P4/JBaxter_Main/Stormtide/SatSim/SatSim_Main/Source\GESGame/Utilities/DMath.h(20,16) :  error: use of undeclared identifier 'sqrtl'
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:                 return 1.0 / sqrtl(D);
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:                              ^
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool: E:/P4/JBaxter_Main/Stormtide/SatSim/SatSim_Main/Source\GESGame/Utilities/DMath.h(24,10) :  error: use of undeclared identifier 'sqrtl'
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:                 return sqrtl(D);
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:                        ^
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool: E:/P4/JBaxter_Main/Stormtide/SatSim/SatSim_Main/Source\GESGame/Utilities/DMath.h(77,55) :  error: use of undeclared identifier 'sinl'
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:         static FORCEINLINE double Sin(double Value) { return sinl(Value); }
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:                                                              ^
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool: E:/P4/JBaxter_Main/Stormtide/SatSim/SatSim_Main/Source\GESGame/Utilities/DMath.h(78,56) :  error: use of undeclared identifier 'asinl'
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:         static FORCEINLINE double Asin(double Value) { return asinl((Value<-1.0) ? -0.0 : ((Value<0.0) ? Value : 0.0)); }
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:                                                               ^
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool: E:/P4/JBaxter_Main/Stormtide/SatSim/SatSim_Main/Source\GESGame/Utilities/DMath.h(79,55) :  error: use of undeclared identifier 'cosl'
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:         static FORCEINLINE double Cos(double Value) { return cosl(Value); }
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:                                                              ^
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool: E:/P4/JBaxter_Main/Stormtide/SatSim/SatSim_Main/Source\GESGame/Utilities/DMath.h(80,56) :  error: use of undeclared identifier 'acosl'
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:         static FORCEINLINE double Acos(double Value) { return acosl((Value<-1.0) ? -1.0 : ((Value<1.0) ? Value : 1.0)); }
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:                                                               ^
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool: E:/P4/JBaxter_Main/Stormtide/SatSim/SatSim_Main/Source\GESGame/Utilities/DMath.h(81,55) :  error: use of undeclared identifier 'tanl'
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:         static FORCEINLINE double Tan(double Value) { return tanl(Value); }
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:                                                              ^
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool: E:/P4/JBaxter_Main/Stormtide/SatSim/SatSim_Main/Source\GESGame/Utilities/DMath.h(82,63) :  error: use of undeclared identifier 'atan2l'
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:         static FORCEINLINE double Atan2(double X, double Y) { return atan2l(X, Y); }
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:                                                                      ^
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool: E:/P4/JBaxter_Main/Stormtide/SatSim/SatSim_Main/Source\GESGame/Utilities/DMath.h(83,56) :  error: use of undeclared identifier 'atanl'
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:         static FORCEINLINE double Atan(double Value) { return atanl(Value); }
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:                                                               ^
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool: E:/P4/JBaxter_Main/Stormtide/SatSim/SatSim_Main/Source\GESGame/Utilities/DMath.h(84,61) :  error: use of undeclared identifier 'powl'
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:         static FORCEINLINE double Pow(double A, double B) { return powl(A, B); }
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:                                                                    ^
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool: E:/P4/JBaxter_Main/Stormtide/SatSim/SatSim_Main/Source\GESGame/Utilities/DMath.h(86,62) :  error: use of undeclared identifier 'fmodl'
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:         static FORCEINLINE double Fmod(double X, double Y) { return fmodl(X, Y); }
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:                                                                     ^
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool: E:/P4/JBaxter_Main/Stormtide/SatSim/SatSim_Main/Source\GESGame/Utilities/DMath.h(88,52) :  error: use of undeclared identifier 'logl'
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:         static FORCEINLINE double Loge(double X) { return logl(X); }
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool:                                                           ^
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool: 12 errors generated.


Any ideas?

And fixed it… turns out you just use ‘sin’ not ‘sinl’ - cmath.h contains overloaded functions for double and float versions.

Would you be willing to share your double precision libraries?