Skip to content

Instantly share code, notes, and snippets.

@eggrobin
Last active April 16, 2018 17:35

Revisions

  1. eggrobin revised this gist Apr 16, 2018. 1 changed file with 20 additions and 1 deletion.
    21 changes: 20 additions & 1 deletion Benchmarks
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    Skylake (tintoretto):
    Run on (4 X 2808 MHz CPU s)
    04/15/18 00:21:19
    -----------------------------------------------------------------
    @@ -13,4 +14,22 @@ BM_KahanCbrt 32508 ns 32785 ns 22400 +1.000000000000
    BM_KahanNoDivCbrt 36240 ns 36098 ns 19478 +1.00000000000000000e+00; ∛2 = +1.25992104989487297e+00
    BM_EggCbrt 31269 ns 31390 ns 22400 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_EggHalleyCbrt 30532 ns 30483 ns 23579 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_MicrosoftCbrt 61004 ns 61384 ns 11200 +1.00000000000000000e+00; ∛2 = +1.25992104989487297e+00
    BM_MicrosoftCbrt 61004 ns 61384 ns 11200 +1.00000000000000000e+00; ∛2 = +1.25992104989487297e+00

    Sandy bridge (bellini):
    Run on (8 X 2672 MHz CPU s)
    04/16/18 19:34:11
    -----------------------------------------------------------------
    Benchmark Time CPU Iterations
    -----------------------------------------------------------------
    BM_AtlasCbrt 29419 ns 29725 ns 23617 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_CephesCbrt 91855 ns 91778 ns 7479 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_FnlibCbrt 115154 ns 114385 ns 6410 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_GlibcCbrt 93547 ns 93863 ns 7479 +1.00000000000000000e+00; ∛2 = +1.25992104989487341e+00
    BM_SunCbrt 57591 ns 57016 ns 11218 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_HouseholderOrder10Cbrt 35982 ns 35948 ns 20396 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_KahanCbrt 46162 ns 45370 ns 15473 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_KahanNoDivCbrt 51208 ns 48672 ns 11218 +1.00000000000000000e+00; ∛2 = +1.25992104989487297e+00
    BM_EggCbrt 48433 ns 47420 ns 14475 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_EggHalleyCbrt 49010 ns 48498 ns 14475 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_MicrosoftCbrt 87056 ns 85520 ns 7479 +1.00000000000000000e+00; ∛2 = +1.25992104989487297e+00
  2. eggrobin revised this gist Apr 15, 2018. 1 changed file with 28 additions and 29 deletions.
    57 changes: 28 additions & 29 deletions Error analysis
    Original file line number Diff line number Diff line change
    @@ -1,63 +1,62 @@

    Tested 100000000 values in [1, 8[.
    Tested 1000000000 values in [1, 8[.

    Trickiest sample values:
    closest to ties : 1/2 + 8.17394E-10 ULPs, for 16^^400730AC7CD4E823
    -1/2 - 1.56327E-08 ULPs, for 16^^40177C9939961AC7
    closest to exact : 7.38256E-09 ULPs, for 16^^40074B92C3475943
    -6.13836E-09 ULPs, for 16^^3FF62D9EC6853830
    -1/2 - 9.28353E-10 ULPs, for 16^^3FF6DF0B48E84DCF
    closest to exact : 4.82551E-10 ULPs, for 16^^401ADB0D51316C07
    -2.74149E-10 ULPs, for 16^^401F725DDC04267A

    Method atlas
    incorrect roundings : 8024940 (8.02494 %)
    incorrect roundings : 80258792 (8.02588 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.727795 ULPs, for 16^^401FACD86A5F1280
    maximal error : 0.728111 ULPs, for 16^^401FACC2E36B306D

    Method cephes
    incorrect roundings : 8555258 (8.55526 %)
    incorrect roundings : 85573996 (8.5574 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.73463 ULPs, for 16^^4006B9121DFA3C1A
    maximal error : 0.735158 ULPs, for 16^^4006A5ACB42905AB

    Method egg
    incorrect roundings : 854 (0.000854 %)
    incorrect roundings : 9001 (0.0009001 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.500077 ULPs, for 16^^401CEF4B05804067
    maximal error : 0.500099 ULPs, for 16^^401CE0915607ACFC

    Method egg_halley
    incorrect roundings : 528 (0.000528 %)
    incorrect roundings : 5155 (0.0005155 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.500031 ULPs, for 16^^3FF4535EAAA87EDA
    maximal error : 0.500055 ULPs, for 16^^3FF14E35E87EA5DF

    Method fnlib
    incorrect roundings : 26048848 (26.0488 %)
    unfaithful roundings : 3076299 (3.0763 %)
    maximal error : 1.64791 ULPs, for 16^^4001491885511E10
    incorrect roundings : 260499512 (26.05 %)
    unfaithful roundings : 30778750 (3.07788 %)
    maximal error : 1.65078 ULPs, for 16^^400128FD6CF4B29D

    Method glibc
    incorrect roundings : 49626627 (49.6266 %)
    unfaithful roundings : 17676996 (17.677 %)
    maximal error : 3.47561 ULPs, for 16^^4007ADA8733AAF36
    incorrect roundings : 496271339 (49.6271 %)
    unfaithful roundings : 176784674 (17.6785 %)
    maximal error : 3.49198 ULPs, for 16^^4007E64AD5EE31FE

    Method householder_order_10
    incorrect roundings : 1728571 (1.72857 %)
    incorrect roundings : 17266868 (1.72669 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.668423 ULPs, for 16^^400FAAEBF2CDC756

    Method kahan
    incorrect roundings : 199822 (0.199822 %)
    incorrect roundings : 2004355 (0.200435 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.597992 ULPs, for 16^^3FF19ECAA5A641DE

    Method kahan_no_div
    incorrect roundings : 56913671 (56.9137 %)
    unfaithful roundings : 26641091 (26.6411 %)
    maximal error : 5.15887 ULPs, for 16^^401FE641182D93D0
    incorrect roundings : 569169664 (56.917 %)
    unfaithful roundings : 266401817 (26.6402 %)
    maximal error : 5.35296 ULPs, for 16^^401FE5772F642288

    Method microsoft
    incorrect roundings : 30276437 (30.2764 %)
    unfaithful roundings : 2667207 (2.66721 %)
    maximal error : 1.82278 ULPs, for 16^^4016320973374662
    incorrect roundings : 302720376 (30.272 %)
    unfaithful roundings : 26685453 (2.66855 %)
    maximal error : 1.83989 ULPs, for 16^^4015749288E278C2

    Method sun
    incorrect roundings : 8319796 (8.3198 %)
    incorrect roundings : 83164169 (8.31642 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.668152 ULPs, for 16^^3FFD1233C0DBD57C
    maximal error : 0.668413 ULPs, for 16^^3FF17856D73BCDF3
  3. eggrobin revised this gist Apr 14, 2018. 1 changed file with 34 additions and 23 deletions.
    57 changes: 34 additions & 23 deletions Error analysis
    Original file line number Diff line number Diff line change
    @@ -1,52 +1,63 @@
    Tested 1000000000 values in [1, 8[.

    Tested 100000000 values in [1, 8[.

    Trickiest sample values:
    closest to ties : 1/2 + 8.17394E-10 ULPs, for 16^^400730AC7CD4E823
    -1/2 - 9.28353E-10 ULPs, for 16^^3FF6DF0B48E84DCF
    closest to exact : 4.82551E-10 ULPs, for 16^^401ADB0D51316C07
    -2.74149E-10 ULPs, for 16^^401F725DDC04267A
    -1/2 - 1.56327E-08 ULPs, for 16^^40177C9939961AC7
    closest to exact : 7.38256E-09 ULPs, for 16^^40074B92C3475943
    -6.13836E-09 ULPs, for 16^^3FF62D9EC6853830

    Method atlas
    incorrect roundings : 80258792 (8.02588 %)
    incorrect roundings : 8024940 (8.02494 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.728111 ULPs, for 16^^401FACC2E36B306D
    maximal error : 0.727795 ULPs, for 16^^401FACD86A5F1280

    Method cephes
    incorrect roundings : 85573996 (8.5574 %)
    incorrect roundings : 8555258 (8.55526 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.735158 ULPs, for 16^^4006A5ACB42905AB
    maximal error : 0.73463 ULPs, for 16^^4006B9121DFA3C1A

    Method egg
    incorrect roundings : 9081 (0.0009081 %)
    incorrect roundings : 854 (0.000854 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.500077 ULPs, for 16^^401CEF4B05804067

    Method egg_halley
    incorrect roundings : 528 (0.000528 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.500099 ULPs, for 16^^401CE0915607ACFC
    maximal error : 0.500031 ULPs, for 16^^3FF4535EAAA87EDA

    Method fnlib
    incorrect roundings : 26048848 (26.0488 %)
    unfaithful roundings : 3076299 (3.0763 %)
    maximal error : 1.64791 ULPs, for 16^^4001491885511E10

    Method glibc
    incorrect roundings : 496271339 (49.6271 %)
    unfaithful roundings : 176784674 (17.6785 %)
    maximal error : 3.49198 ULPs, for 16^^4007E64AD5EE31FE
    incorrect roundings : 49626627 (49.6266 %)
    unfaithful roundings : 17676996 (17.677 %)
    maximal error : 3.47561 ULPs, for 16^^4007ADA8733AAF36

    Method householder_order_10
    incorrect roundings : 17266868 (1.72669 %)
    incorrect roundings : 1728571 (1.72857 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.668423 ULPs, for 16^^400FAAEBF2CDC756

    Method kahan
    incorrect roundings : 2004355 (0.200435 %)
    incorrect roundings : 199822 (0.199822 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.597992 ULPs, for 16^^3FF19ECAA5A641DE

    Method kahan_no_div
    incorrect roundings : 569169664 (56.917 %)
    unfaithful roundings : 266401817 (26.6402 %)
    maximal error : 5.35296 ULPs, for 16^^401FE5772F642288
    incorrect roundings : 56913671 (56.9137 %)
    unfaithful roundings : 26641091 (26.6411 %)
    maximal error : 5.15887 ULPs, for 16^^401FE641182D93D0

    Method microsoft
    incorrect roundings : 302720376 (30.272 %)
    unfaithful roundings : 26685453 (2.66855 %)
    maximal error : 1.83989 ULPs, for 16^^4015749288E278C2
    incorrect roundings : 30276437 (30.2764 %)
    unfaithful roundings : 2667207 (2.66721 %)
    maximal error : 1.82278 ULPs, for 16^^4016320973374662

    Method sun
    incorrect roundings : 83164169 (8.31642 %)
    incorrect roundings : 8319796 (8.3198 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.668413 ULPs, for 16^^3FF17856D73BCDF3
    maximal error : 0.668152 ULPs, for 16^^3FFD1233C0DBD57C
  4. eggrobin revised this gist Apr 14, 2018. 1 changed file with 12 additions and 10 deletions.
    22 changes: 12 additions & 10 deletions Benchmarks
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,16 @@
    Run on (4 X 2808 MHz CPU s)
    04/13/18 14:35:47
    04/15/18 00:21:19
    -----------------------------------------------------------------
    Benchmark Time CPU Iterations
    -----------------------------------------------------------------
    BM_AtlasCbrt 24199 ns 24065 ns 29867 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_CephesCbrt 72127 ns 71498 ns 8960 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_GlibcCbrt 69186 ns 62779 ns 11200 +1.00000000000000000e+00; ∛2 = +1.25992104989487341e+00
    BM_SunCbrt 46288 ns 44993 ns 14933 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_HouseholderOrder10Cbrt 23000 ns 22949 ns 32000 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_KahanCbrt 34022 ns 31459 ns 20364 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_KahanNoDivCbrt 38635 ns 37493 ns 17920 +1.00000000000000000e+00; ∛2 = +1.25992104989487297e+00
    BM_EggCbrt 32556 ns 32227 ns 21333 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_MicrosoftCbrt 62982 ns 57813 ns 10000 +1.00000000000000000e+00; ∛2 = +1.25992104989487297e+00
    BM_AtlasCbrt 23203 ns 23019 ns 29867 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_CephesCbrt 71982 ns 71498 ns 8960 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_FnlibCbrt 81198 ns 80218 ns 8960 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_GlibcCbrt 65066 ns 65569 ns 11200 +1.00000000000000000e+00; ∛2 = +1.25992104989487341e+00
    BM_SunCbrt 44721 ns 44504 ns 15448 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_HouseholderOrder10Cbrt 22035 ns 21973 ns 32000 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_KahanCbrt 32508 ns 32785 ns 22400 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_KahanNoDivCbrt 36240 ns 36098 ns 19478 +1.00000000000000000e+00; ∛2 = +1.25992104989487297e+00
    BM_EggCbrt 31269 ns 31390 ns 22400 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_EggHalleyCbrt 30532 ns 30483 ns 23579 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_MicrosoftCbrt 61004 ns 61384 ns 11200 +1.00000000000000000e+00; ∛2 = +1.25992104989487297e+00
  5. eggrobin revised this gist Apr 13, 2018. 1 changed file with 23 additions and 23 deletions.
    46 changes: 23 additions & 23 deletions Error analysis
    Original file line number Diff line number Diff line change
    @@ -1,52 +1,52 @@
    Tested 100000000 values in [1, 8[.
    Tested 1000000000 values in [1, 8[.

    Trickiest sample values:
    closest to ties : 1/2 + 8.17394E-10 ULPs, for 16^^400730AC7CD4E823
    -1/2 - 1.56327E-08 ULPs, for 16^^40177C9939961AC7
    closest to exact : 7.38256E-09 ULPs, for 16^^40074B92C3475943
    -6.13836E-09 ULPs, for 16^^3FF62D9EC6853830
    -1/2 - 9.28353E-10 ULPs, for 16^^3FF6DF0B48E84DCF
    closest to exact : 4.82551E-10 ULPs, for 16^^401ADB0D51316C07
    -2.74149E-10 ULPs, for 16^^401F725DDC04267A

    Method atlas
    incorrect roundings : 8024940 (8.02494 %)
    incorrect roundings : 80258792 (8.02588 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.727795 ULPs, for 16^^401FACD86A5F1280
    maximal error : 0.728111 ULPs, for 16^^401FACC2E36B306D

    Method cephes
    incorrect roundings : 8555258 (8.55526 %)
    incorrect roundings : 85573996 (8.5574 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.73463 ULPs, for 16^^4006B9121DFA3C1A
    maximal error : 0.735158 ULPs, for 16^^4006A5ACB42905AB

    Method egg
    incorrect roundings : 873 (0.000873 %)
    incorrect roundings : 9081 (0.0009081 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.500077 ULPs, for 16^^40060E9BB3F0D816
    maximal error : 0.500099 ULPs, for 16^^401CE0915607ACFC

    Method glibc
    incorrect roundings : 49626627 (49.6266 %)
    unfaithful roundings : 17676996 (17.677 %)
    maximal error : 3.47561 ULPs, for 16^^4007ADA8733AAF36
    incorrect roundings : 496271339 (49.6271 %)
    unfaithful roundings : 176784674 (17.6785 %)
    maximal error : 3.49198 ULPs, for 16^^4007E64AD5EE31FE

    Method householder_order_10
    incorrect roundings : 1728571 (1.72857 %)
    incorrect roundings : 17266868 (1.72669 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.668423 ULPs, for 16^^400FAAEBF2CDC756

    Method kahan
    incorrect roundings : 199822 (0.199822 %)
    incorrect roundings : 2004355 (0.200435 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.597992 ULPs, for 16^^3FF19ECAA5A641DE

    Method kahan_no_div
    incorrect roundings : 56913671 (56.9137 %)
    unfaithful roundings : 26641091 (26.6411 %)
    maximal error : 5.15887 ULPs, for 16^^401FE641182D93D0
    incorrect roundings : 569169664 (56.917 %)
    unfaithful roundings : 266401817 (26.6402 %)
    maximal error : 5.35296 ULPs, for 16^^401FE5772F642288

    Method microsoft
    incorrect roundings : 30276437 (30.2764 %)
    unfaithful roundings : 2667207 (2.66721 %)
    maximal error : 1.82278 ULPs, for 16^^4016320973374662
    incorrect roundings : 302720376 (30.272 %)
    unfaithful roundings : 26685453 (2.66855 %)
    maximal error : 1.83989 ULPs, for 16^^4015749288E278C2

    Method sun
    incorrect roundings : 8319796 (8.3198 %)
    incorrect roundings : 83164169 (8.31642 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.668152 ULPs, for 16^^3FFD1233C0DBD57C
    maximal error : 0.668413 ULPs, for 16^^3FF17856D73BCDF3
  6. eggrobin revised this gist Apr 13, 2018. 1 changed file with 52 additions and 0 deletions.
    52 changes: 52 additions & 0 deletions Error analysis
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,52 @@
    Tested 100000000 values in [1, 8[.

    Trickiest sample values:
    closest to ties : 1/2 + 8.17394E-10 ULPs, for 16^^400730AC7CD4E823
    -1/2 - 1.56327E-08 ULPs, for 16^^40177C9939961AC7
    closest to exact : 7.38256E-09 ULPs, for 16^^40074B92C3475943
    -6.13836E-09 ULPs, for 16^^3FF62D9EC6853830

    Method atlas
    incorrect roundings : 8024940 (8.02494 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.727795 ULPs, for 16^^401FACD86A5F1280

    Method cephes
    incorrect roundings : 8555258 (8.55526 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.73463 ULPs, for 16^^4006B9121DFA3C1A

    Method egg
    incorrect roundings : 873 (0.000873 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.500077 ULPs, for 16^^40060E9BB3F0D816

    Method glibc
    incorrect roundings : 49626627 (49.6266 %)
    unfaithful roundings : 17676996 (17.677 %)
    maximal error : 3.47561 ULPs, for 16^^4007ADA8733AAF36

    Method householder_order_10
    incorrect roundings : 1728571 (1.72857 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.668423 ULPs, for 16^^400FAAEBF2CDC756

    Method kahan
    incorrect roundings : 199822 (0.199822 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.597992 ULPs, for 16^^3FF19ECAA5A641DE

    Method kahan_no_div
    incorrect roundings : 56913671 (56.9137 %)
    unfaithful roundings : 26641091 (26.6411 %)
    maximal error : 5.15887 ULPs, for 16^^401FE641182D93D0

    Method microsoft
    incorrect roundings : 30276437 (30.2764 %)
    unfaithful roundings : 2667207 (2.66721 %)
    maximal error : 1.82278 ULPs, for 16^^4016320973374662

    Method sun
    incorrect roundings : 8319796 (8.3198 %)
    unfaithful roundings : 0 (0 %)
    maximal error : 0.668152 ULPs, for 16^^3FFD1233C0DBD57C
  7. eggrobin created this gist Apr 13, 2018.
    14 changes: 14 additions & 0 deletions Benchmarks
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    Run on (4 X 2808 MHz CPU s)
    04/13/18 14:35:47
    -----------------------------------------------------------------
    Benchmark Time CPU Iterations
    -----------------------------------------------------------------
    BM_AtlasCbrt 24199 ns 24065 ns 29867 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_CephesCbrt 72127 ns 71498 ns 8960 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_GlibcCbrt 69186 ns 62779 ns 11200 +1.00000000000000000e+00; ∛2 = +1.25992104989487341e+00
    BM_SunCbrt 46288 ns 44993 ns 14933 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_HouseholderOrder10Cbrt 23000 ns 22949 ns 32000 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_KahanCbrt 34022 ns 31459 ns 20364 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_KahanNoDivCbrt 38635 ns 37493 ns 17920 +1.00000000000000000e+00; ∛2 = +1.25992104989487297e+00
    BM_EggCbrt 32556 ns 32227 ns 21333 +1.00000000000000000e+00; ∛2 = +1.25992104989487319e+00
    BM_MicrosoftCbrt 62982 ns 57813 ns 10000 +1.00000000000000000e+00; ∛2 = +1.25992104989487297e+00