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

Trigonometric functions precision #22

Open
MarekKnapek opened this issue Nov 7, 2020 · 1 comment
Open

Trigonometric functions precision #22

MarekKnapek opened this issue Nov 7, 2020 · 1 comment

Comments

@MarekKnapek
Copy link
Contributor

Hi, I like your library, but I cannot find any information about precision guarantees.

In my program, I need a precomputed lookup table of some angles. Before I discovered your library I computed the values at run-time and copy & pasted them into my source. After I discovered your library I wanted to assert, that my precomputed table values match constexpr computation from your library. And this test failed.

I noticed, that your computation are sometimes off by one at last significant place. So, I wanted to ask what precision do you guarantee? Is this a bug or is this (sometimes off by one at ULP) intended behavior? Or maybe it is not possible to compute trigonometric functions precisely at compile-time at all?

I created a little test program, it computes sin and cos of all angles from -15 to +15 degrees, stepping by one degree. I compiled it on Ubuntu 18.04 using GCC/G++ 10, and on Windows using Visual Studio 2019 (19.27.29112).

Best regards, Marek.

The program:

#include <cmath>
#include <cstdio>
#include <numbers>

#include <gcem.hpp>

int main()
{
	static constexpr auto const deg_to_rad = [](double const& deg) -> double { return deg * (std::numbers::pi_v<double> / 180.0); };
	for(int i = -15; i != 15 + 1; ++i)
	{
		std::printf("std::cos (%+3d deg) == %.30f (%a)\n", i, std::cos(deg_to_rad(i)), std::cos(deg_to_rad(i)));
		std::printf("gcem::cos(%+3d deg) == %.30f (%a)%s\n", i, gcem::cos(deg_to_rad(i)), gcem::cos(deg_to_rad(i)), std::cos(deg_to_rad(i)) == gcem::cos(deg_to_rad(i)) ? "" : " bug");
	}
	for(int i = -15; i != 15 + 1; ++i)
	{
		std::printf("std::sin (%+3d deg) == %.30f (%a)\n", i, std::sin(deg_to_rad(i)), std::sin(deg_to_rad(i)));
		std::printf("gcem::sin(%+3d deg) == %.30f (%a)%s\n", i, gcem::sin(deg_to_rad(i)), gcem::sin(deg_to_rad(i)), std::sin(deg_to_rad(i)) == gcem::sin(deg_to_rad(i)) ? "" : " bug");
	}
}

Compile on Ubuntu:

g++-10 -std=c++20 gcem_trig_check.cpp

Output on Ubuntu:

std::cos (-15 deg) == 0.965925826289068312213714762038 (0x1.ee8dd4748bf15p-1)
gcem::cos(-15 deg) == 0.965925826289068312213714762038 (0x1.ee8dd4748bf15p-1)
std::cos (-14 deg) == 0.970295726275996472942608761514 (0x1.f0ca99f79ba25p-1)
gcem::cos(-14 deg) == 0.970295726275996583964911224029 (0x1.f0ca99f79ba26p-1) bug
std::cos (-13 deg) == 0.974370064785235245885530730447 (0x1.f2e0a214e870fp-1)
gcem::cos(-13 deg) == 0.974370064785235245885530730447 (0x1.f2e0a214e870fp-1)
std::cos (-12 deg) == 0.978147600733805688832944724709 (0x1.f4cfc327a008p-1)
gcem::cos(-12 deg) == 0.978147600733805577810642262193 (0x1.f4cfc327a007fp-1) bug
std::cos (-11 deg) == 0.981627183447663975712771389226 (0x1.f697d6938b6c2p-1)
gcem::cos(-11 deg) == 0.981627183447663975712771389226 (0x1.f697d6938b6c2p-1)
std::cos (-10 deg) == 0.984807753012208020315654266597 (0x1.f838b8c811c17p-1)
gcem::cos(-10 deg) == 0.984807753012208131337956729112 (0x1.f838b8c811c18p-1) bug
std::cos ( -9 deg) == 0.987688340595137770350220307591 (0x1.f9b24942fe45cp-1)
gcem::cos( -9 deg) == 0.987688340595137659327917845076 (0x1.f9b24942fe45bp-1) bug
std::cos ( -8 deg) == 0.990268068741570361979142944620 (0x1.fb046a930947ap-1)
gcem::cos( -8 deg) == 0.990268068741570473001445407135 (0x1.fb046a930947bp-1) bug
std::cos ( -7 deg) == 0.992546151641321983127852490725 (0x1.fc2f025a23e8bp-1)
gcem::cos( -7 deg) == 0.992546151641322094150154953240 (0x1.fc2f025a23e8cp-1) bug
std::cos ( -6 deg) == 0.994521895368273289861349439889 (0x1.fd31f94f867c6p-1)
gcem::cos( -6 deg) == 0.994521895368273289861349439889 (0x1.fd31f94f867c6p-1)
std::cos ( -5 deg) == 0.996194698091745545198705258372 (0x1.fe0d3b41815a2p-1)
gcem::cos( -5 deg) == 0.996194698091745434176402795856 (0x1.fe0d3b41815a1p-1) bug
std::cos ( -4 deg) == 0.997564050259824197652847033169 (0x1.fec0b7170fff6p-1)
gcem::cos( -4 deg) == 0.997564050259824197652847033169 (0x1.fec0b7170fff6p-1)
std::cos ( -3 deg) == 0.998629534754573833232882407174 (0x1.ff4c5ed12e61dp-1)
gcem::cos( -3 deg) == 0.998629534754573833232882407174 (0x1.ff4c5ed12e61dp-1)
std::cos ( -2 deg) == 0.999390827019095762118183756684 (0x1.ffb0278bf0567p-1)
gcem::cos( -2 deg) == 0.999390827019095651095881294168 (0x1.ffb0278bf0566p-1) bug
std::cos ( -1 deg) == 0.999847695156391269577511593525 (0x1.ffec097f5af8ap-1)
gcem::cos( -1 deg) == 0.999847695156391158555209131009 (0x1.ffec097f5af89p-1) bug
std::cos ( +0 deg) == 1.000000000000000000000000000000 (0x1p+0)
gcem::cos( +0 deg) == 1.000000000000000000000000000000 (0x1p+0)
std::cos ( +1 deg) == 0.999847695156391269577511593525 (0x1.ffec097f5af8ap-1)
gcem::cos( +1 deg) == 0.999847695156391158555209131009 (0x1.ffec097f5af89p-1) bug
std::cos ( +2 deg) == 0.999390827019095762118183756684 (0x1.ffb0278bf0567p-1)
gcem::cos( +2 deg) == 0.999390827019095651095881294168 (0x1.ffb0278bf0566p-1) bug
std::cos ( +3 deg) == 0.998629534754573833232882407174 (0x1.ff4c5ed12e61dp-1)
gcem::cos( +3 deg) == 0.998629534754573833232882407174 (0x1.ff4c5ed12e61dp-1)
std::cos ( +4 deg) == 0.997564050259824197652847033169 (0x1.fec0b7170fff6p-1)
gcem::cos( +4 deg) == 0.997564050259824197652847033169 (0x1.fec0b7170fff6p-1)
std::cos ( +5 deg) == 0.996194698091745545198705258372 (0x1.fe0d3b41815a2p-1)
gcem::cos( +5 deg) == 0.996194698091745434176402795856 (0x1.fe0d3b41815a1p-1) bug
std::cos ( +6 deg) == 0.994521895368273289861349439889 (0x1.fd31f94f867c6p-1)
gcem::cos( +6 deg) == 0.994521895368273289861349439889 (0x1.fd31f94f867c6p-1)
std::cos ( +7 deg) == 0.992546151641321983127852490725 (0x1.fc2f025a23e8bp-1)
gcem::cos( +7 deg) == 0.992546151641322094150154953240 (0x1.fc2f025a23e8cp-1) bug
std::cos ( +8 deg) == 0.990268068741570361979142944620 (0x1.fb046a930947ap-1)
gcem::cos( +8 deg) == 0.990268068741570473001445407135 (0x1.fb046a930947bp-1) bug
std::cos ( +9 deg) == 0.987688340595137770350220307591 (0x1.f9b24942fe45cp-1)
gcem::cos( +9 deg) == 0.987688340595137659327917845076 (0x1.f9b24942fe45bp-1) bug
std::cos (+10 deg) == 0.984807753012208020315654266597 (0x1.f838b8c811c17p-1)
gcem::cos(+10 deg) == 0.984807753012208131337956729112 (0x1.f838b8c811c18p-1) bug
std::cos (+11 deg) == 0.981627183447663975712771389226 (0x1.f697d6938b6c2p-1)
gcem::cos(+11 deg) == 0.981627183447663975712771389226 (0x1.f697d6938b6c2p-1)
std::cos (+12 deg) == 0.978147600733805688832944724709 (0x1.f4cfc327a008p-1)
gcem::cos(+12 deg) == 0.978147600733805577810642262193 (0x1.f4cfc327a007fp-1) bug
std::cos (+13 deg) == 0.974370064785235245885530730447 (0x1.f2e0a214e870fp-1)
gcem::cos(+13 deg) == 0.974370064785235245885530730447 (0x1.f2e0a214e870fp-1)
std::cos (+14 deg) == 0.970295726275996472942608761514 (0x1.f0ca99f79ba25p-1)
gcem::cos(+14 deg) == 0.970295726275996583964911224029 (0x1.f0ca99f79ba26p-1) bug
std::cos (+15 deg) == 0.965925826289068312213714762038 (0x1.ee8dd4748bf15p-1)
gcem::cos(+15 deg) == 0.965925826289068312213714762038 (0x1.ee8dd4748bf15p-1)
std::sin (-15 deg) == -0.258819045102520739476403832668 (-0x1.0907dc193069p-2)
gcem::sin(-15 deg) == -0.258819045102520739476403832668 (-0x1.0907dc193069p-2)
std::sin (-14 deg) == -0.241921895599667730047954705697 (-0x1.ef74bf2e4b91dp-3)
gcem::sin(-14 deg) == -0.241921895599667730047954705697 (-0x1.ef74bf2e4b91dp-3)
std::sin (-13 deg) == -0.224951054343865003426472526371 (-0x1.ccb3236cdc675p-3)
gcem::sin(-13 deg) == -0.224951054343864975670896910742 (-0x1.ccb3236cdc674p-3) bug
std::sin (-12 deg) == -0.207911690817759342575499204031 (-0x1.a9cd9ac4258f6p-3)
gcem::sin(-12 deg) == -0.207911690817759314819923588402 (-0x1.a9cd9ac4258f5p-3) bug
std::sin (-11 deg) == -0.190808995376544804356555573577 (-0x1.86c6ddd76624fp-3)
gcem::sin(-11 deg) == -0.190808995376544804356555573577 (-0x1.86c6ddd76624fp-3)
std::sin (-10 deg) == -0.173648177666930331186634361984 (-0x1.63a1a7e0b7389p-3)
gcem::sin(-10 deg) == -0.173648177666930358942209977613 (-0x1.63a1a7e0b738ap-3) bug
std::sin ( -9 deg) == -0.156434465040230868959625354364 (-0x1.4060b67a85375p-3)
gcem::sin( -9 deg) == -0.156434465040230868959625354364 (-0x1.4060b67a85375p-3)
std::sin ( -8 deg) == -0.139173100960065437847745783984 (-0x1.1d06c968d9e19p-3)
gcem::sin( -8 deg) == -0.139173100960065465603321399612 (-0x1.1d06c968d9e1ap-3) bug
std::sin ( -7 deg) == -0.121869343405147476100403025612 (-0x1.f32d44c4f62d3p-4)
gcem::sin( -7 deg) == -0.121869343405147489978190833426 (-0x1.f32d44c4f62d4p-4) bug
std::sin ( -6 deg) == -0.104528463267653470847307062286 (-0x1.ac2609b3c576cp-4)
gcem::sin( -6 deg) == -0.104528463267653456969519254471 (-0x1.ac2609b3c576bp-4) bug
std::sin ( -5 deg) == -0.087155742747658165869850677154 (-0x1.64fd6b8c28102p-4)
gcem::sin( -5 deg) == -0.087155742747658151992062869340 (-0x1.64fd6b8c28101p-4) bug
std::sin ( -4 deg) == -0.069756473744125302438590097154 (-0x1.1db8f6d6a5128p-4)
gcem::sin( -4 deg) == -0.069756473744125302438590097154 (-0x1.1db8f6d6a5128p-4)
std::sin ( -3 deg) == -0.052335956242943834637593170100 (-0x1.acbc748efc90ep-5)
gcem::sin( -3 deg) == -0.052335956242943834637593170100 (-0x1.acbc748efc90ep-5)
std::sin ( -2 deg) == -0.034899496702500969191884649945 (-0x1.1de58c9f7dc27p-5)
gcem::sin( -2 deg) == -0.034899496702500969191884649945 (-0x1.1de58c9f7dc27p-5)
std::sin ( -1 deg) == -0.017452406437283511653202339176 (-0x1.1df0b2b89dd1ep-6)
gcem::sin( -1 deg) == -0.017452406437283511653202339176 (-0x1.1df0b2b89dd1ep-6)
std::sin ( +0 deg) == 0.000000000000000000000000000000 (0x0p+0)
gcem::sin( +0 deg) == 0.000000000000000000000000000000 (0x0p+0)
std::sin ( +1 deg) == 0.017452406437283511653202339176 (0x1.1df0b2b89dd1ep-6)
gcem::sin( +1 deg) == 0.017452406437283511653202339176 (0x1.1df0b2b89dd1ep-6)
std::sin ( +2 deg) == 0.034899496702500969191884649945 (0x1.1de58c9f7dc27p-5)
gcem::sin( +2 deg) == 0.034899496702500969191884649945 (0x1.1de58c9f7dc27p-5)
std::sin ( +3 deg) == 0.052335956242943834637593170100 (0x1.acbc748efc90ep-5)
gcem::sin( +3 deg) == 0.052335956242943834637593170100 (0x1.acbc748efc90ep-5)
std::sin ( +4 deg) == 0.069756473744125302438590097154 (0x1.1db8f6d6a5128p-4)
gcem::sin( +4 deg) == 0.069756473744125302438590097154 (0x1.1db8f6d6a5128p-4)
std::sin ( +5 deg) == 0.087155742747658165869850677154 (0x1.64fd6b8c28102p-4)
gcem::sin( +5 deg) == 0.087155742747658151992062869340 (0x1.64fd6b8c28101p-4) bug
std::sin ( +6 deg) == 0.104528463267653470847307062286 (0x1.ac2609b3c576cp-4)
gcem::sin( +6 deg) == 0.104528463267653456969519254471 (0x1.ac2609b3c576bp-4) bug
std::sin ( +7 deg) == 0.121869343405147476100403025612 (0x1.f32d44c4f62d3p-4)
gcem::sin( +7 deg) == 0.121869343405147489978190833426 (0x1.f32d44c4f62d4p-4) bug
std::sin ( +8 deg) == 0.139173100960065437847745783984 (0x1.1d06c968d9e19p-3)
gcem::sin( +8 deg) == 0.139173100960065465603321399612 (0x1.1d06c968d9e1ap-3) bug
std::sin ( +9 deg) == 0.156434465040230868959625354364 (0x1.4060b67a85375p-3)
gcem::sin( +9 deg) == 0.156434465040230868959625354364 (0x1.4060b67a85375p-3)
std::sin (+10 deg) == 0.173648177666930331186634361984 (0x1.63a1a7e0b7389p-3)
gcem::sin(+10 deg) == 0.173648177666930358942209977613 (0x1.63a1a7e0b738ap-3) bug
std::sin (+11 deg) == 0.190808995376544804356555573577 (0x1.86c6ddd76624fp-3)
gcem::sin(+11 deg) == 0.190808995376544804356555573577 (0x1.86c6ddd76624fp-3)
std::sin (+12 deg) == 0.207911690817759342575499204031 (0x1.a9cd9ac4258f6p-3)
gcem::sin(+12 deg) == 0.207911690817759314819923588402 (0x1.a9cd9ac4258f5p-3) bug
std::sin (+13 deg) == 0.224951054343865003426472526371 (0x1.ccb3236cdc675p-3)
gcem::sin(+13 deg) == 0.224951054343864975670896910742 (0x1.ccb3236cdc674p-3) bug
std::sin (+14 deg) == 0.241921895599667730047954705697 (0x1.ef74bf2e4b91dp-3)
gcem::sin(+14 deg) == 0.241921895599667730047954705697 (0x1.ef74bf2e4b91dp-3)
std::sin (+15 deg) == 0.258819045102520739476403832668 (0x1.0907dc193069p-2)
gcem::sin(+15 deg) == 0.258819045102520739476403832668 (0x1.0907dc193069p-2)

Compile on Windows:

cl /std:c++latest gcem_trig_test.cpp

Output on Windows:

std::cos (-15 deg) == 0.965925826289068312213714762038 (0x1.ee8dd4748bf15p-1)
gcem::cos(-15 deg) == 0.965925826289068312213714762038 (0x1.ee8dd4748bf15p-1)
std::cos (-14 deg) == 0.970295726275996472942608761514 (0x1.f0ca99f79ba25p-1)
gcem::cos(-14 deg) == 0.970295726275996583964911224029 (0x1.f0ca99f79ba26p-1) bug
std::cos (-13 deg) == 0.974370064785235245885530730447 (0x1.f2e0a214e870fp-1)
gcem::cos(-13 deg) == 0.974370064785235245885530730447 (0x1.f2e0a214e870fp-1)
std::cos (-12 deg) == 0.978147600733805688832944724709 (0x1.f4cfc327a0080p-1)
gcem::cos(-12 deg) == 0.978147600733805577810642262193 (0x1.f4cfc327a007fp-1) bug
std::cos (-11 deg) == 0.981627183447663975712771389226 (0x1.f697d6938b6c2p-1)
gcem::cos(-11 deg) == 0.981627183447663975712771389226 (0x1.f697d6938b6c2p-1)
std::cos (-10 deg) == 0.984807753012208020315654266597 (0x1.f838b8c811c17p-1)
gcem::cos(-10 deg) == 0.984807753012208131337956729112 (0x1.f838b8c811c18p-1) bug
std::cos ( -9 deg) == 0.987688340595137770350220307591 (0x1.f9b24942fe45cp-1)
gcem::cos( -9 deg) == 0.987688340595137659327917845076 (0x1.f9b24942fe45bp-1) bug
std::cos ( -8 deg) == 0.990268068741570361979142944620 (0x1.fb046a930947ap-1)
gcem::cos( -8 deg) == 0.990268068741570473001445407135 (0x1.fb046a930947bp-1) bug
std::cos ( -7 deg) == 0.992546151641321983127852490725 (0x1.fc2f025a23e8bp-1)
gcem::cos( -7 deg) == 0.992546151641322094150154953240 (0x1.fc2f025a23e8cp-1) bug
std::cos ( -6 deg) == 0.994521895368273289861349439889 (0x1.fd31f94f867c6p-1)
gcem::cos( -6 deg) == 0.994521895368273289861349439889 (0x1.fd31f94f867c6p-1)
std::cos ( -5 deg) == 0.996194698091745545198705258372 (0x1.fe0d3b41815a2p-1)
gcem::cos( -5 deg) == 0.996194698091745434176402795856 (0x1.fe0d3b41815a1p-1) bug
std::cos ( -4 deg) == 0.997564050259824197652847033169 (0x1.fec0b7170fff6p-1)
gcem::cos( -4 deg) == 0.997564050259824197652847033169 (0x1.fec0b7170fff6p-1)
std::cos ( -3 deg) == 0.998629534754573833232882407174 (0x1.ff4c5ed12e61dp-1)
gcem::cos( -3 deg) == 0.998629534754573833232882407174 (0x1.ff4c5ed12e61dp-1)
std::cos ( -2 deg) == 0.999390827019095762118183756684 (0x1.ffb0278bf0567p-1)
gcem::cos( -2 deg) == 0.999390827019095651095881294168 (0x1.ffb0278bf0566p-1) bug
std::cos ( -1 deg) == 0.999847695156391269577511593525 (0x1.ffec097f5af8ap-1)
gcem::cos( -1 deg) == 0.999847695156391158555209131009 (0x1.ffec097f5af89p-1) bug
std::cos ( +0 deg) == 1.000000000000000000000000000000 (0x1.0000000000000p+0)
gcem::cos( +0 deg) == 1.000000000000000000000000000000 (0x1.0000000000000p+0)
std::cos ( +1 deg) == 0.999847695156391269577511593525 (0x1.ffec097f5af8ap-1)
gcem::cos( +1 deg) == 0.999847695156391158555209131009 (0x1.ffec097f5af89p-1) bug
std::cos ( +2 deg) == 0.999390827019095762118183756684 (0x1.ffb0278bf0567p-1)
gcem::cos( +2 deg) == 0.999390827019095651095881294168 (0x1.ffb0278bf0566p-1) bug
std::cos ( +3 deg) == 0.998629534754573833232882407174 (0x1.ff4c5ed12e61dp-1)
gcem::cos( +3 deg) == 0.998629534754573833232882407174 (0x1.ff4c5ed12e61dp-1)
std::cos ( +4 deg) == 0.997564050259824197652847033169 (0x1.fec0b7170fff6p-1)
gcem::cos( +4 deg) == 0.997564050259824197652847033169 (0x1.fec0b7170fff6p-1)
std::cos ( +5 deg) == 0.996194698091745545198705258372 (0x1.fe0d3b41815a2p-1)
gcem::cos( +5 deg) == 0.996194698091745434176402795856 (0x1.fe0d3b41815a1p-1) bug
std::cos ( +6 deg) == 0.994521895368273289861349439889 (0x1.fd31f94f867c6p-1)
gcem::cos( +6 deg) == 0.994521895368273289861349439889 (0x1.fd31f94f867c6p-1)
std::cos ( +7 deg) == 0.992546151641321983127852490725 (0x1.fc2f025a23e8bp-1)
gcem::cos( +7 deg) == 0.992546151641322094150154953240 (0x1.fc2f025a23e8cp-1) bug
std::cos ( +8 deg) == 0.990268068741570361979142944620 (0x1.fb046a930947ap-1)
gcem::cos( +8 deg) == 0.990268068741570473001445407135 (0x1.fb046a930947bp-1) bug
std::cos ( +9 deg) == 0.987688340595137770350220307591 (0x1.f9b24942fe45cp-1)
gcem::cos( +9 deg) == 0.987688340595137659327917845076 (0x1.f9b24942fe45bp-1) bug
std::cos (+10 deg) == 0.984807753012208020315654266597 (0x1.f838b8c811c17p-1)
gcem::cos(+10 deg) == 0.984807753012208131337956729112 (0x1.f838b8c811c18p-1) bug
std::cos (+11 deg) == 0.981627183447663975712771389226 (0x1.f697d6938b6c2p-1)
gcem::cos(+11 deg) == 0.981627183447663975712771389226 (0x1.f697d6938b6c2p-1)
std::cos (+12 deg) == 0.978147600733805688832944724709 (0x1.f4cfc327a0080p-1)
gcem::cos(+12 deg) == 0.978147600733805577810642262193 (0x1.f4cfc327a007fp-1) bug
std::cos (+13 deg) == 0.974370064785235245885530730447 (0x1.f2e0a214e870fp-1)
gcem::cos(+13 deg) == 0.974370064785235245885530730447 (0x1.f2e0a214e870fp-1)
std::cos (+14 deg) == 0.970295726275996472942608761514 (0x1.f0ca99f79ba25p-1)
gcem::cos(+14 deg) == 0.970295726275996583964911224029 (0x1.f0ca99f79ba26p-1) bug
std::cos (+15 deg) == 0.965925826289068312213714762038 (0x1.ee8dd4748bf15p-1)
gcem::cos(+15 deg) == 0.965925826289068312213714762038 (0x1.ee8dd4748bf15p-1)
std::sin (-15 deg) == -0.258819045102520739476403832668 (-0x1.0907dc1930690p-2)
gcem::sin(-15 deg) == -0.258819045102520739476403832668 (-0x1.0907dc1930690p-2)
std::sin (-14 deg) == -0.241921895599667730047954705697 (-0x1.ef74bf2e4b91dp-3)
gcem::sin(-14 deg) == -0.241921895599667730047954705697 (-0x1.ef74bf2e4b91dp-3)
std::sin (-13 deg) == -0.224951054343865003426472526371 (-0x1.ccb3236cdc675p-3)
gcem::sin(-13 deg) == -0.224951054343864975670896910742 (-0x1.ccb3236cdc674p-3) bug
std::sin (-12 deg) == -0.207911690817759342575499204031 (-0x1.a9cd9ac4258f6p-3)
gcem::sin(-12 deg) == -0.207911690817759314819923588402 (-0x1.a9cd9ac4258f5p-3) bug
std::sin (-11 deg) == -0.190808995376544804356555573577 (-0x1.86c6ddd76624fp-3)
gcem::sin(-11 deg) == -0.190808995376544804356555573577 (-0x1.86c6ddd76624fp-3)
std::sin (-10 deg) == -0.173648177666930331186634361984 (-0x1.63a1a7e0b7389p-3)
gcem::sin(-10 deg) == -0.173648177666930358942209977613 (-0x1.63a1a7e0b738ap-3) bug
std::sin ( -9 deg) == -0.156434465040230868959625354364 (-0x1.4060b67a85375p-3)
gcem::sin( -9 deg) == -0.156434465040230868959625354364 (-0x1.4060b67a85375p-3)
std::sin ( -8 deg) == -0.139173100960065437847745783984 (-0x1.1d06c968d9e19p-3)
gcem::sin( -8 deg) == -0.139173100960065465603321399612 (-0x1.1d06c968d9e1ap-3) bug
std::sin ( -7 deg) == -0.121869343405147476100403025612 (-0x1.f32d44c4f62d3p-4)
gcem::sin( -7 deg) == -0.121869343405147489978190833426 (-0x1.f32d44c4f62d4p-4) bug
std::sin ( -6 deg) == -0.104528463267653470847307062286 (-0x1.ac2609b3c576cp-4)
gcem::sin( -6 deg) == -0.104528463267653456969519254471 (-0x1.ac2609b3c576bp-4) bug
std::sin ( -5 deg) == -0.087155742747658165869850677154 (-0x1.64fd6b8c28102p-4)
gcem::sin( -5 deg) == -0.087155742747658151992062869340 (-0x1.64fd6b8c28101p-4) bug
std::sin ( -4 deg) == -0.069756473744125302438590097154 (-0x1.1db8f6d6a5128p-4)
gcem::sin( -4 deg) == -0.069756473744125302438590097154 (-0x1.1db8f6d6a5128p-4)
std::sin ( -3 deg) == -0.052335956242943834637593170100 (-0x1.acbc748efc90ep-5)
gcem::sin( -3 deg) == -0.052335956242943834637593170100 (-0x1.acbc748efc90ep-5)
std::sin ( -2 deg) == -0.034899496702500969191884649945 (-0x1.1de58c9f7dc27p-5)
gcem::sin( -2 deg) == -0.034899496702500969191884649945 (-0x1.1de58c9f7dc27p-5)
std::sin ( -1 deg) == -0.017452406437283511653202339176 (-0x1.1df0b2b89dd1ep-6)
gcem::sin( -1 deg) == -0.017452406437283511653202339176 (-0x1.1df0b2b89dd1ep-6)
std::sin ( +0 deg) == 0.000000000000000000000000000000 (0x0.0000000000000p+0)
gcem::sin( +0 deg) == 0.000000000000000000000000000000 (0x0.0000000000000p+0)
std::sin ( +1 deg) == 0.017452406437283511653202339176 (0x1.1df0b2b89dd1ep-6)
gcem::sin( +1 deg) == 0.017452406437283511653202339176 (0x1.1df0b2b89dd1ep-6)
std::sin ( +2 deg) == 0.034899496702500969191884649945 (0x1.1de58c9f7dc27p-5)
gcem::sin( +2 deg) == 0.034899496702500969191884649945 (0x1.1de58c9f7dc27p-5)
std::sin ( +3 deg) == 0.052335956242943834637593170100 (0x1.acbc748efc90ep-5)
gcem::sin( +3 deg) == 0.052335956242943834637593170100 (0x1.acbc748efc90ep-5)
std::sin ( +4 deg) == 0.069756473744125302438590097154 (0x1.1db8f6d6a5128p-4)
gcem::sin( +4 deg) == 0.069756473744125302438590097154 (0x1.1db8f6d6a5128p-4)
std::sin ( +5 deg) == 0.087155742747658165869850677154 (0x1.64fd6b8c28102p-4)
gcem::sin( +5 deg) == 0.087155742747658151992062869340 (0x1.64fd6b8c28101p-4) bug
std::sin ( +6 deg) == 0.104528463267653470847307062286 (0x1.ac2609b3c576cp-4)
gcem::sin( +6 deg) == 0.104528463267653456969519254471 (0x1.ac2609b3c576bp-4) bug
std::sin ( +7 deg) == 0.121869343405147476100403025612 (0x1.f32d44c4f62d3p-4)
gcem::sin( +7 deg) == 0.121869343405147489978190833426 (0x1.f32d44c4f62d4p-4) bug
std::sin ( +8 deg) == 0.139173100960065437847745783984 (0x1.1d06c968d9e19p-3)
gcem::sin( +8 deg) == 0.139173100960065465603321399612 (0x1.1d06c968d9e1ap-3) bug
std::sin ( +9 deg) == 0.156434465040230868959625354364 (0x1.4060b67a85375p-3)
gcem::sin( +9 deg) == 0.156434465040230868959625354364 (0x1.4060b67a85375p-3)
std::sin (+10 deg) == 0.173648177666930331186634361984 (0x1.63a1a7e0b7389p-3)
gcem::sin(+10 deg) == 0.173648177666930358942209977613 (0x1.63a1a7e0b738ap-3) bug
std::sin (+11 deg) == 0.190808995376544804356555573577 (0x1.86c6ddd76624fp-3)
gcem::sin(+11 deg) == 0.190808995376544804356555573577 (0x1.86c6ddd76624fp-3)
std::sin (+12 deg) == 0.207911690817759342575499204031 (0x1.a9cd9ac4258f6p-3)
gcem::sin(+12 deg) == 0.207911690817759314819923588402 (0x1.a9cd9ac4258f5p-3) bug
std::sin (+13 deg) == 0.224951054343865003426472526371 (0x1.ccb3236cdc675p-3)
gcem::sin(+13 deg) == 0.224951054343864975670896910742 (0x1.ccb3236cdc674p-3) bug
std::sin (+14 deg) == 0.241921895599667730047954705697 (0x1.ef74bf2e4b91dp-3)
gcem::sin(+14 deg) == 0.241921895599667730047954705697 (0x1.ef74bf2e4b91dp-3)
std::sin (+15 deg) == 0.258819045102520739476403832668 (0x1.0907dc1930690p-2)
gcem::sin(+15 deg) == 0.258819045102520739476403832668 (0x1.0907dc1930690p-2)
@AuroraDysis
Copy link

@MarekKnapek Morwenn/static_math#19 provides a better solution (but not good enough).

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

No branches or pull requests

2 participants