LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package math_test | 5 package math_test |
6 | 6 |
7 import ( | 7 import ( |
8 "fmt" | 8 "fmt" |
9 . "math" | 9 . "math" |
10 "runtime" | 10 "runtime" |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 {+Pi, NaN()}, | 738 {+Pi, NaN()}, |
739 {Inf(1), Inf(-1)}, | 739 {Inf(1), Inf(-1)}, |
740 {Inf(1), -Pi}, | 740 {Inf(1), -Pi}, |
741 {Inf(1), 0}, | 741 {Inf(1), 0}, |
742 {Inf(1), +Pi}, | 742 {Inf(1), +Pi}, |
743 {Inf(1), Inf(1)}, | 743 {Inf(1), Inf(1)}, |
744 {Inf(1), NaN()}, | 744 {Inf(1), NaN()}, |
745 {NaN(), NaN()}, | 745 {NaN(), NaN()}, |
746 } | 746 } |
747 var atan2SC = []float64{ | 747 var atan2SC = []float64{ |
748 » -3 * Pi / 4, // atan2(-Inf, -Inf) | 748 » -3 * Pi / 4, // atan2(-Inf, -Inf) |
749 » -Pi / 2, // atan2(-Inf, -Pi) | 749 » -Pi / 2, // atan2(-Inf, -Pi) |
750 » -Pi / 2, // atan2(-Inf, +0) | 750 » -Pi / 2, // atan2(-Inf, +0) |
751 » -Pi / 2, // atan2(-Inf, +Pi) | 751 » -Pi / 2, // atan2(-Inf, +Pi) |
752 » -Pi / 4, // atan2(-Inf, +Inf) | 752 » -Pi / 4, // atan2(-Inf, +Inf) |
753 » NaN(), // atan2(-Inf, NaN) | 753 » NaN(), // atan2(-Inf, NaN) |
754 » -Pi, // atan2(-Pi, -Inf) | 754 » -Pi, // atan2(-Pi, -Inf) |
755 » -Pi / 2, // atan2(-Pi, +0) | 755 » -Pi / 2, // atan2(-Pi, +0) |
756 » -0, // atan2(-Pi, Inf) | 756 » -0, // atan2(-Pi, Inf) |
757 » NaN(), // atan2(-Pi, NaN) | 757 » NaN(), // atan2(-Pi, NaN) |
758 » -Pi, // atan2(-0, -Inf) | 758 » -Pi, // atan2(-0, -Inf) |
759 » -Pi, // atan2(-0, -Pi) | 759 » -Pi, // atan2(-0, -Pi) |
760 » -Pi, // atan2(-0, -0) | 760 » -Pi, // atan2(-0, -0) |
761 » -0, // atan2(-0, +0) | 761 » -0, // atan2(-0, +0) |
762 » -0, // atan2(-0, +Pi) | 762 » -0, // atan2(-0, +Pi) |
763 » -0, // atan2(-0, +Inf) | 763 » -0, // atan2(-0, +Inf) |
764 » NaN(), // atan2(-0, NaN) | 764 » NaN(), // atan2(-0, NaN) |
765 » Pi, // atan2(+0, -Inf) | 765 » Pi, // atan2(+0, -Inf) |
766 » Pi, // atan2(+0, -Pi) | 766 » Pi, // atan2(+0, -Pi) |
767 » Pi, // atan2(+0, -0) | 767 » Pi, // atan2(+0, -0) |
768 » 0, // atan2(+0, +0) | 768 » 0, // atan2(+0, +0) |
769 » 0, // atan2(+0, +Pi) | 769 » 0, // atan2(+0, +Pi) |
770 » 0, // atan2(+0, +Inf) | 770 » 0, // atan2(+0, +Inf) |
771 » NaN(), // atan2(+0, NaN) | 771 » NaN(), // atan2(+0, NaN) |
772 » Pi, // atan2(+Pi, -Inf) | 772 » Pi, // atan2(+Pi, -Inf) |
773 » Pi / 2, // atan2(+Pi, +0) | 773 » Pi / 2, // atan2(+Pi, +0) |
774 » 0, // atan2(+Pi, +Inf) | 774 » 0, // atan2(+Pi, +Inf) |
775 » NaN(), // atan2(+Pi, NaN) | 775 » NaN(), // atan2(+Pi, NaN) |
776 » 3 * Pi / 4, // atan2(+Inf, -Inf) | 776 » 3 * Pi / 4, // atan2(+Inf, -Inf) |
777 » Pi / 2, // atan2(+Inf, -Pi) | 777 » Pi / 2, // atan2(+Inf, -Pi) |
778 » Pi / 2, // atan2(+Inf, +0) | 778 » Pi / 2, // atan2(+Inf, +0) |
779 » Pi / 2, // atan2(+Inf, +Pi) | 779 » Pi / 2, // atan2(+Inf, +Pi) |
780 » Pi / 4, // atan2(+Inf, +Inf) | 780 » Pi / 4, // atan2(+Inf, +Inf) |
781 » NaN(), // atan2(+Inf, NaN) | 781 » NaN(), // atan2(+Inf, NaN) |
782 » NaN(), // atan2(NaN, NaN) | 782 » NaN(), // atan2(NaN, NaN) |
783 } | 783 } |
784 | 784 |
785 var vfcbrtSC = []float64{ | 785 var vfcbrtSC = []float64{ |
786 Inf(-1), | 786 Inf(-1), |
787 -0, | 787 -0, |
788 0, | 788 0, |
789 Inf(1), | 789 Inf(1), |
790 NaN(), | 790 NaN(), |
791 } | 791 } |
792 var cbrtSC = []float64{ | 792 var cbrtSC = []float64{ |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 {Inf(1), Inf(1)}, | 950 {Inf(1), Inf(1)}, |
951 {Inf(1), NaN()}, | 951 {Inf(1), NaN()}, |
952 {NaN(), Inf(-1)}, | 952 {NaN(), Inf(-1)}, |
953 {NaN(), -Pi}, | 953 {NaN(), -Pi}, |
954 {NaN(), 0}, | 954 {NaN(), 0}, |
955 {NaN(), Pi}, | 955 {NaN(), Pi}, |
956 {NaN(), Inf(1)}, | 956 {NaN(), Inf(1)}, |
957 {NaN(), NaN()}, | 957 {NaN(), NaN()}, |
958 } | 958 } |
959 var fmodSC = []float64{ | 959 var fmodSC = []float64{ |
960 » NaN(), // fmod(-Inf, -Inf) | 960 » NaN(), // fmod(-Inf, -Inf) |
961 » NaN(), // fmod(-Inf, -Pi) | 961 » NaN(), // fmod(-Inf, -Pi) |
962 » NaN(), // fmod(-Inf, 0) | 962 » NaN(), // fmod(-Inf, 0) |
963 » NaN(), // fmod(-Inf, Pi) | 963 » NaN(), // fmod(-Inf, Pi) |
964 » NaN(), // fmod(-Inf, +Inf) | 964 » NaN(), // fmod(-Inf, +Inf) |
965 » NaN(), // fmod(-Inf, NaN) | 965 » NaN(), // fmod(-Inf, NaN) |
966 » -Pi, // fmod(-Pi, -Inf) | 966 » -Pi, // fmod(-Pi, -Inf) |
967 » NaN(), // fmod(-Pi, 0) | 967 » NaN(), // fmod(-Pi, 0) |
968 » -Pi, // fmod(-Pi, +Inf) | 968 » -Pi, // fmod(-Pi, +Inf) |
969 » NaN(), // fmod(-Pi, NaN) | 969 » NaN(), // fmod(-Pi, NaN) |
970 » -0, // fmod(-0, -Inf) | 970 » -0, // fmod(-0, -Inf) |
971 » NaN(), // fmod(-0, 0) | 971 » NaN(), // fmod(-0, 0) |
972 » -0, // fmod(-0, Inf) | 972 » -0, // fmod(-0, Inf) |
973 » NaN(), // fmod(-0, NaN) | 973 » NaN(), // fmod(-0, NaN) |
974 » 0, // fmod(0, -Inf) | 974 » 0, // fmod(0, -Inf) |
975 » NaN(), // fmod(0, 0) | 975 » NaN(), // fmod(0, 0) |
976 » 0, // fmod(0, +Inf) | 976 » 0, // fmod(0, +Inf) |
977 » NaN(), // fmod(0, NaN) | 977 » NaN(), // fmod(0, NaN) |
978 » Pi, // fmod(Pi, -Inf) | 978 » Pi, // fmod(Pi, -Inf) |
979 » NaN(), // fmod(Pi, 0) | 979 » NaN(), // fmod(Pi, 0) |
980 » Pi, // fmod(Pi, +Inf) | 980 » Pi, // fmod(Pi, +Inf) |
981 » NaN(), // fmod(Pi, NaN) | 981 » NaN(), // fmod(Pi, NaN) |
982 » NaN(), // fmod(+Inf, -Inf) | 982 » NaN(), // fmod(+Inf, -Inf) |
983 » NaN(), // fmod(+Inf, -Pi) | 983 » NaN(), // fmod(+Inf, -Pi) |
984 » NaN(), // fmod(+Inf, 0) | 984 » NaN(), // fmod(+Inf, 0) |
985 » NaN(), // fmod(+Inf, Pi) | 985 » NaN(), // fmod(+Inf, Pi) |
986 » NaN(), // fmod(+Inf, +Inf) | 986 » NaN(), // fmod(+Inf, +Inf) |
987 » NaN(), // fmod(+Inf, NaN) | 987 » NaN(), // fmod(+Inf, NaN) |
988 » NaN(), // fmod(NaN, -Inf) | 988 » NaN(), // fmod(NaN, -Inf) |
989 » NaN(), // fmod(NaN, -Pi) | 989 » NaN(), // fmod(NaN, -Pi) |
990 » NaN(), // fmod(NaN, 0) | 990 » NaN(), // fmod(NaN, 0) |
991 » NaN(), // fmod(NaN, Pi) | 991 » NaN(), // fmod(NaN, Pi) |
992 » NaN(), // fmod(NaN, +Inf) | 992 » NaN(), // fmod(NaN, +Inf) |
993 » NaN(), // fmod(NaN, NaN) | 993 » NaN(), // fmod(NaN, NaN) |
994 } | 994 } |
995 | 995 |
996 var vffrexpSC = []float64{ | 996 var vffrexpSC = []float64{ |
997 Inf(-1), | 997 Inf(-1), |
998 -0, | 998 -0, |
999 0, | 999 0, |
1000 Inf(1), | 1000 Inf(1), |
1001 NaN(), | 1001 NaN(), |
1002 } | 1002 } |
1003 var frexpSC = []fi{ | 1003 var frexpSC = []fi{ |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 {Inf(1), Pi}, | 1291 {Inf(1), Pi}, |
1292 {Inf(1), NaN()}, | 1292 {Inf(1), NaN()}, |
1293 {NaN(), -Pi}, | 1293 {NaN(), -Pi}, |
1294 {NaN(), -0}, | 1294 {NaN(), -0}, |
1295 {NaN(), 0}, | 1295 {NaN(), 0}, |
1296 {NaN(), 1}, | 1296 {NaN(), 1}, |
1297 {NaN(), Pi}, | 1297 {NaN(), Pi}, |
1298 {NaN(), NaN()}, | 1298 {NaN(), NaN()}, |
1299 } | 1299 } |
1300 var powSC = []float64{ | 1300 var powSC = []float64{ |
1301 » 0, // pow(-Inf, -Pi) | 1301 » 0, // pow(-Inf, -Pi) |
1302 » -0, // pow(-Inf, -3) | 1302 » -0, // pow(-Inf, -3) |
1303 » 1, // pow(-Inf, -0) | 1303 » 1, // pow(-Inf, -0) |
1304 » 1, // pow(-Inf, +0) | 1304 » 1, // pow(-Inf, +0) |
1305 » Inf(-1), // pow(-Inf, 1) | 1305 » Inf(-1), // pow(-Inf, 1) |
1306 » Inf(-1), // pow(-Inf, 3) | 1306 » Inf(-1), // pow(-Inf, 3) |
1307 » Inf(1), // pow(-Inf, Pi) | 1307 » Inf(1), // pow(-Inf, Pi) |
1308 » NaN(), // pow(-Inf, NaN) | 1308 » NaN(), // pow(-Inf, NaN) |
1309 » 0, // pow(-Pi, -Inf) | 1309 » 0, // pow(-Pi, -Inf) |
1310 » NaN(), // pow(-Pi, -Pi) | 1310 » NaN(), // pow(-Pi, -Pi) |
1311 » 1, // pow(-Pi, -0) | 1311 » 1, // pow(-Pi, -0) |
1312 » 1, // pow(-Pi, +0) | 1312 » 1, // pow(-Pi, +0) |
1313 » -Pi, // pow(-Pi, 1) | 1313 » -Pi, // pow(-Pi, 1) |
1314 » NaN(), // pow(-Pi, Pi) | 1314 » NaN(), // pow(-Pi, Pi) |
1315 » Inf(1), // pow(-Pi, +Inf) | 1315 » Inf(1), // pow(-Pi, +Inf) |
1316 » NaN(), // pow(-Pi, NaN) | 1316 » NaN(), // pow(-Pi, NaN) |
1317 » 1, // pow(-1, -Inf) IEEE 754-2008 | 1317 » 1, // pow(-1, -Inf) IEEE 754-2008 |
1318 » 1, // pow(-1, +Inf) IEEE 754-2008 | 1318 » 1, // pow(-1, +Inf) IEEE 754-2008 |
1319 » NaN(), // pow(-1, NaN) | 1319 » NaN(), // pow(-1, NaN) |
1320 » Inf(1), // pow(-1/2, -Inf) | 1320 » Inf(1), // pow(-1/2, -Inf) |
1321 » 0, // pow(-1/2, +Inf) | 1321 » 0, // pow(-1/2, +Inf) |
1322 » Inf(1), // pow(-0, -Inf) | 1322 » Inf(1), // pow(-0, -Inf) |
1323 » Inf(1), // pow(-0, -Pi) | 1323 » Inf(1), // pow(-0, -Pi) |
1324 » Inf(-1), // pow(-0, -3) IEEE 754-2008 | 1324 » Inf(-1), // pow(-0, -3) IEEE 754-2008 |
1325 » -0, // pow(-0, 3) IEEE 754-2008 | 1325 » -0, // pow(-0, 3) IEEE 754-2008 |
1326 » 0, // pow(-0, +Pi) | 1326 » 0, // pow(-0, +Pi) |
1327 » 0, // pow(-0, +Inf) | 1327 » 0, // pow(-0, +Inf) |
1328 » Inf(1), // pow(+0, -Inf) | 1328 » Inf(1), // pow(+0, -Inf) |
1329 » Inf(1), // pow(+0, -Pi) | 1329 » Inf(1), // pow(+0, -Pi) |
1330 » Inf(1), // pow(+0, -3) | 1330 » Inf(1), // pow(+0, -3) |
1331 » 1, // pow(+0, -0) | 1331 » 1, // pow(+0, -0) |
1332 » 1, // pow(+0, +0) | 1332 » 1, // pow(+0, +0) |
1333 » 0, // pow(+0, 3) | 1333 » 0, // pow(+0, 3) |
1334 » 0, // pow(+0, +Pi) | 1334 » 0, // pow(+0, +Pi) |
1335 » 0, // pow(+0, +Inf) | 1335 » 0, // pow(+0, +Inf) |
1336 » NaN(), // pow(+0, NaN) | 1336 » NaN(), // pow(+0, NaN) |
1337 » Inf(1), // pow(1/2, -Inf) | 1337 » Inf(1), // pow(1/2, -Inf) |
1338 » 0, // pow(1/2, +Inf) | 1338 » 0, // pow(1/2, +Inf) |
1339 » 1, // pow(1, -Inf) IEEE 754-2008 | 1339 » 1, // pow(1, -Inf) IEEE 754-2008 |
1340 » 1, // pow(1, +Inf) IEEE 754-2008 | 1340 » 1, // pow(1, +Inf) IEEE 754-2008 |
1341 » 1, // pow(1, NaN) IEEE 754-2008 | 1341 » 1, // pow(1, NaN) IEEE 754-2008 |
1342 » 0, // pow(+Pi, -Inf) | 1342 » 0, // pow(+Pi, -Inf) |
1343 » 1, // pow(+Pi, -0) | 1343 » 1, // pow(+Pi, -0) |
1344 » 1, // pow(+Pi, +0) | 1344 » 1, // pow(+Pi, +0) |
1345 » Pi, // pow(+Pi, 1) | 1345 » Pi, // pow(+Pi, 1) |
1346 » Inf(1), // pow(+Pi, +Inf) | 1346 » Inf(1), // pow(+Pi, +Inf) |
1347 » NaN(), // pow(+Pi, NaN) | 1347 » NaN(), // pow(+Pi, NaN) |
1348 » 0, // pow(+Inf, -Pi) | 1348 » 0, // pow(+Inf, -Pi) |
1349 » 1, // pow(+Inf, -0) | 1349 » 1, // pow(+Inf, -0) |
1350 » 1, // pow(+Inf, +0) | 1350 » 1, // pow(+Inf, +0) |
1351 » Inf(1), // pow(+Inf, 1) | 1351 » Inf(1), // pow(+Inf, 1) |
1352 » Inf(1), // pow(+Inf, Pi) | 1352 » Inf(1), // pow(+Inf, Pi) |
1353 » NaN(), // pow(+Inf, NaN) | 1353 » NaN(), // pow(+Inf, NaN) |
1354 » NaN(), // pow(NaN, -Pi) | 1354 » NaN(), // pow(NaN, -Pi) |
1355 » 1, // pow(NaN, -0) | 1355 » 1, // pow(NaN, -0) |
1356 » 1, // pow(NaN, +0) | 1356 » 1, // pow(NaN, +0) |
1357 » NaN(), // pow(NaN, 1) | 1357 » NaN(), // pow(NaN, 1) |
1358 » NaN(), // pow(NaN, +Pi) | 1358 » NaN(), // pow(NaN, +Pi) |
1359 » NaN(), // pow(NaN, NaN) | 1359 » NaN(), // pow(NaN, NaN) |
1360 } | 1360 } |
1361 | 1361 |
1362 var vfsignbitSC = []float64{ | 1362 var vfsignbitSC = []float64{ |
1363 Inf(-1), | 1363 Inf(-1), |
1364 -0, | 1364 -0, |
1365 0, | 1365 0, |
1366 Inf(1), | 1366 Inf(1), |
1367 NaN(), | 1367 NaN(), |
1368 } | 1368 } |
1369 var signbitSC = []bool{ | 1369 var signbitSC = []bool{ |
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2728 for i := 0; i < b.N; i++ { | 2728 for i := 0; i < b.N; i++ { |
2729 Y1(2.5) | 2729 Y1(2.5) |
2730 } | 2730 } |
2731 } | 2731 } |
2732 | 2732 |
2733 func BenchmarkYn(b *testing.B) { | 2733 func BenchmarkYn(b *testing.B) { |
2734 for i := 0; i < b.N; i++ { | 2734 for i := 0; i < b.N; i++ { |
2735 Yn(2, 2.5) | 2735 Yn(2, 2.5) |
2736 } | 2736 } |
2737 } | 2737 } |
LEFT | RIGHT |