Changeset 96321 in vbox for trunk/src/VBox/Runtime/testcase
- Timestamp:
- Aug 19, 2022 2:55:13 AM (2 years ago)
- Location:
- trunk/src/VBox/Runtime/testcase
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/Makefile.kmk
r96298 r96321 681 681 ../common/math/lrint.asm \ 682 682 ../common/math/lrintf.asm \ 683 ../common/math/pow.asm \ 683 684 ../common/math/remainder.asm \ 684 685 ../common/math/remainderf.asm \ -
trunk/src/VBox/Runtime/testcase/tstRTNoCrt-2.cpp
r96298 r96321 336 336 RTStrFormatR64(g_szFloat[2], sizeof(g_szFloat[2]), &uExpectMax, 0, 0, RTSTR_F_SPECIAL); \ 337 337 RTTestFailed(g_hTest, "line %u: %s -> %s, expected [%s,%s] (%s +/- %s)", \ 338 __LINE__, #a_Expr, g_szFloat[0], g_szFloat[1], #a_rdExpect, #a_rdPlusMin); \338 __LINE__, #a_Expr, g_szFloat[0], g_szFloat[1], g_szFloat[2], #a_rdExpect, #a_rdPlusMin); \ 339 339 } \ 340 340 } while (0) … … 416 416 RTStrFormatR32(g_szFloat[2], sizeof(g_szFloat[2]), &uExpectMax, 0, 0, RTSTR_F_SPECIAL); \ 417 417 RTTestFailed(g_hTest, "line %u: %s -> %s, expected [%s,%s] (%s +/- %s)", \ 418 __LINE__, #a_Expr, g_szFloat[0], g_szFloat[1], #a_rfExpect, #a_rfPlusMin); \418 __LINE__, #a_Expr, g_szFloat[0], g_szFloat[1], g_szFloat[2], #a_rfExpect, #a_rfPlusMin); \ 419 419 } \ 420 420 } while (0) … … 2708 2708 } 2709 2709 2710 2711 void testPow() 2712 { 2713 RTTestSub(g_hTest, "pow[f]"); 2714 CHECK_DBL(RT_NOCRT(pow)(1.0, 1.0), 1.0); 2715 CHECK_DBL(RT_NOCRT(pow)(2.0, 1.0), 2.0); 2716 CHECK_DBL(RT_NOCRT(pow)(2.0, 2.0), 4.0); 2717 CHECK_DBL(RT_NOCRT(pow)(2.0, 43.0), 8796093022208.0); 2718 CHECK_DBL( RT_NOCRT(pow)( +1.0, 43.0), +1.0); /* 6. base=1 exp=wathever -> +1.0 */ 2719 CHECK_DBL( RT_NOCRT(pow)( +1.0, +0.0), +1.0); /* 6. base=1 exp=wathever -> +1.0 */ 2720 CHECK_DBL( RT_NOCRT(pow)( +1.0, -0.0), +1.0); /* 6. base=1 exp=wathever -> +1.0 */ 2721 CHECK_DBL( RT_NOCRT(pow)( +1.0, -34.5534), +1.0); /* 6. base=1 exp=wathever -> +1.0 */ 2722 CHECK_DBL( RT_NOCRT(pow)( +1.0, +1.0e+128), +1.0); /* 6. base=1 exp=wathever -> +1.0 */ 2723 CHECK_DBL( RT_NOCRT(pow)( +1.0, -1.0e+128), +1.0); /* 6. base=1 exp=wathever -> +1.0 */ 2724 CHECK_DBL( RT_NOCRT(pow)( +1.0, +INFINITY), +1.0); /* 6. base=1 exp=wathever -> +1.0 */ 2725 CHECK_DBL( RT_NOCRT(pow)( +1.0, -INFINITY), +1.0); /* 6. base=1 exp=wathever -> +1.0 */ 2726 CHECK_DBL( RT_NOCRT(pow)( +1.0, RTStrNanDouble(NULL, true)), +1.0); /* 6. base=1 exp=wathever -> +1.0 */ 2727 CHECK_DBL( RT_NOCRT(pow)( +1.0, RTStrNanDouble("s", false)), +1.0); /* 6. base=1 exp=wathever -> +1.0 */ 2728 CHECK_DBL( RT_NOCRT(pow)( -1.0, +INFINITY), +1.0); /* 10. Exponent = +/-Inf and base = -1: Return 1.0 */ 2729 CHECK_DBL( RT_NOCRT(pow)( +0.9, -INFINITY), +INFINITY); /* 11. Exponent = -Inf and |base| < 1: Return +Inf */ 2730 CHECK_DBL( RT_NOCRT(pow)( +0.3490, -INFINITY), +INFINITY); /* 11. Exponent = -Inf and |base| < 1: Return +Inf */ 2731 CHECK_DBL( RT_NOCRT(pow)( -0.9, -INFINITY), +INFINITY); /* 11. Exponent = -Inf and |base| < 1: Return +Inf */ 2732 CHECK_DBL( RT_NOCRT(pow)( -0.165634, -INFINITY), +INFINITY); /* 11. Exponent = -Inf and |base| < 1: Return +Inf */ 2733 CHECK_DBL( RT_NOCRT(pow)( -1.000001, -INFINITY), +0.0); /* 12. Exponent = -Inf and |base| > 1: Return +0 */ 2734 CHECK_DBL( RT_NOCRT(pow)( +1.000001, -INFINITY), +0.0); /* 12. Exponent = -Inf and |base| > 1: Return +0 */ 2735 CHECK_DBL( RT_NOCRT(pow)( +42.1, -INFINITY), +0.0); /* 12. Exponent = -Inf and |base| > 1: Return +0 */ 2736 CHECK_DBL( RT_NOCRT(pow)( -42.1e+34, -INFINITY), +0.0); /* 12. Exponent = -Inf and |base| > 1: Return +0 */ 2737 CHECK_DBL( RT_NOCRT(pow)( +42.1e+99, -INFINITY), +0.0); /* 12. Exponent = -Inf and |base| > 1: Return +0 */ 2738 CHECK_DBL( RT_NOCRT(pow)( +0.8, +INFINITY), +0.0); /* 13. Exponent = +Inf and |base| < 1: Return +0 */ 2739 CHECK_DBL( RT_NOCRT(pow)( -0.8, +INFINITY), +0.0); /* 13. Exponent = +Inf and |base| < 1: Return +0 */ 2740 CHECK_DBL( RT_NOCRT(pow)( +1.000003, +INFINITY), +INFINITY); /* 14. Exponent = +Inf and |base| > 1: Return +Inf */ 2741 CHECK_DBL( RT_NOCRT(pow)( -1.000003, +INFINITY), +INFINITY); /* 14. Exponent = +Inf and |base| > 1: Return +Inf */ 2742 CHECK_DBL( RT_NOCRT(pow)( +42.000003e+67, +INFINITY), +INFINITY); /* 14. Exponent = +Inf and |base| > 1: Return +Inf */ 2743 CHECK_DBL( RT_NOCRT(pow)( -996.6567e+109, +INFINITY), +INFINITY); /* 14. Exponent = +Inf and |base| > 1: Return +Inf */ 2744 CHECK_DBL( RT_NOCRT(pow)( -1.23, 1.1), RTStrNanDouble(NULL, false)); /* 1. Finit base < 0 and finit non-interger exponent: -> domain error (#IE) + NaN. */ 2745 CHECK_DBL( RT_NOCRT(pow)( -2.0, -42.353), RTStrNanDouble(NULL, false)); /* 1. Finit base < 0 and finit non-interger exponent: -> domain error (#IE) + NaN. */ 2746 CHECK_DBL( RT_NOCRT(pow)( -2.0, -0.0), +1.0); /* 7. Exponent = +/-0.0, any base value including NaN: return +1.0 */ 2747 CHECK_DBL( RT_NOCRT(pow)( -2.0, +0.0), +1.0); /* 7. Exponent = +/-0.0, any base value including NaN: return +1.0 */ 2748 CHECK_DBL( RT_NOCRT(pow)( -INFINITY, -0.0), +1.0); /* 7. Exponent = +/-0.0, any base value including NaN: return +1.0 */ 2749 CHECK_DBL( RT_NOCRT(pow)( -INFINITY, +0.0), +1.0); /* 7. Exponent = +/-0.0, any base value including NaN: return +1.0 */ 2750 CHECK_DBL( RT_NOCRT(pow)( +INFINITY, -0.0), +1.0); /* 7. Exponent = +/-0.0, any base value including NaN: return +1.0 */ 2751 CHECK_DBL( RT_NOCRT(pow)( +INFINITY, +0.0), +1.0); /* 7. Exponent = +/-0.0, any base value including NaN: return +1.0 */ 2752 CHECK_DBL( RT_NOCRT(pow)( RTStrNanDouble("s", false), -0.0), +1.0); /* 7. Exponent = +/-0.0, any base value including NaN: return +1.0 */ 2753 CHECK_DBL( RT_NOCRT(pow)( RTStrNanDouble(NULL, true), +0.0), +1.0); /* 7. Exponent = +/-0.0, any base value including NaN: return +1.0 */ 2754 CHECK_DBL( RT_NOCRT(pow)( -0.0, -19.0), -INFINITY); /* 4a. base == +/-0.0 and exp < 0 and exp is odd integer: Return +/-Inf, raise div/0. */ 2755 CHECK_DBL( RT_NOCRT(pow)( +0.0, -7.0), +INFINITY); /* 4a. base == +/-0.0 and exp < 0 and exp is odd integer: Return +/-Inf, raise div/0. */ 2756 CHECK_DBL( RT_NOCRT(pow)( -0.0, -8.0), +INFINITY); /* 4b. base == +/-0.0 and exp < 0 and exp is not odd int: Return +Inf, raise div/0. */ 2757 CHECK_DBL( RT_NOCRT(pow)( +0.0, -8.0), +INFINITY); /* 4b. base == +/-0.0 and exp < 0 and exp is not odd int: Return +Inf, raise div/0. */ 2758 CHECK_DBL( RT_NOCRT(pow)( -0.0, -9.1), +INFINITY); /* 4b. base == +/-0.0 and exp < 0 and exp is not odd int: Return +Inf, raise div/0. */ 2759 CHECK_DBL( RT_NOCRT(pow)( +0.0, -9.1), +INFINITY); /* 4b. base == +/-0.0 and exp < 0 and exp is not odd int: Return +Inf, raise div/0. */ 2760 CHECK_DBL( RT_NOCRT(pow)( -0.0, +49.0), -0.0); /* 8. base == +/-0.0 and exp > 0 and exp is odd integer: Return +/-0.0 */ 2761 CHECK_DBL( RT_NOCRT(pow)( -0.0, +999999999.0), -0.0); /* 8. base == +/-0.0 and exp > 0 and exp is odd integer: Return +/-0.0 */ 2762 CHECK_DBL( RT_NOCRT(pow)( +0.0, +88888881.0), +0.0); /* 8. base == +/-0.0 and exp > 0 and exp is odd integer: Return +/-0.0 */ 2763 CHECK_DBL( RT_NOCRT(pow)( +0.0, +3.0), +0.0); /* 8. base == +/-0.0 and exp > 0 and exp is odd integer: Return +/-0.0 */ 2764 CHECK_DBL( RT_NOCRT(pow)( +0.0, +4.0), +0.0); /* 9. base == +/-0.0 and exp > 0 and exp is not odd int: Return +0 */ 2765 CHECK_DBL( RT_NOCRT(pow)( -0.0, +4.0), +0.0); /* 9. base == +/-0.0 and exp > 0 and exp is not odd int: Return +0 */ 2766 CHECK_DBL( RT_NOCRT(pow)( +0.0, +3.1), +0.0); /* 9. base == +/-0.0 and exp > 0 and exp is not odd int: Return +0 */ 2767 CHECK_DBL( RT_NOCRT(pow)( -0.0, +3.1), +0.0); /* 9. base == +/-0.0 and exp > 0 and exp is not odd int: Return +0 */ 2768 CHECK_DBL( RT_NOCRT(pow)( +0.0, +999999999.9), +0.0); /* 9. base == +/-0.0 and exp > 0 and exp is not odd int: Return +0 */ 2769 CHECK_DBL( RT_NOCRT(pow)( -0.0, +999999999.9), +0.0); /* 9. base == +/-0.0 and exp > 0 and exp is not odd int: Return +0 */ 2770 CHECK_DBL( RT_NOCRT(pow)( -INFINITY, -999999999.0), -0.0); /* 15. base == -Inf and exp < 0 and exp is odd integer: Return -0 */ 2771 CHECK_DBL( RT_NOCRT(pow)( -INFINITY, -3.0), -0.0); /* 15. base == -Inf and exp < 0 and exp is odd integer: Return -0 */ 2772 CHECK_DBL( RT_NOCRT(pow)( -INFINITY, -3.1), +0.0); /* 16. base == -Inf and exp < 0 and exp is not odd int: Return +0 */ 2773 CHECK_DBL( RT_NOCRT(pow)( -INFINITY, -4.0), +0.0); /* 16. base == -Inf and exp < 0 and exp is not odd int: Return +0 */ 2774 CHECK_DBL( RT_NOCRT(pow)( -INFINITY, +3.0), -INFINITY); /* 17. base == -Inf and exp > 0 and exp is odd integer: Return -Inf */ 2775 CHECK_DBL( RT_NOCRT(pow)( -INFINITY, +7777777777.0), -INFINITY); /* 17. base == -Inf and exp > 0 and exp is odd integer: Return -Inf */ 2776 CHECK_DBL( RT_NOCRT(pow)( -INFINITY, +7777777777.7), +INFINITY); /* 18. base == -Inf and exp > 0 and exp is not odd int: Return +Inf */ 2777 CHECK_DBL( RT_NOCRT(pow)( -INFINITY, +4.0), +INFINITY); /* 18. base == -Inf and exp > 0 and exp is not odd int: Return +Inf */ 2778 CHECK_DBL( RT_NOCRT(pow)( +INFINITY, -4.0), +0.0); /* 19. base == +Inf and exp < 0: Return +0 */ 2779 CHECK_DBL( RT_NOCRT(pow)( +INFINITY, -0.9), +0.0); /* 19. base == +Inf and exp < 0: Return +0 */ 2780 CHECK_DBL( RT_NOCRT(pow)( +INFINITY, -4.4), +0.0); /* 19. base == +Inf and exp < 0: Return +0 */ 2781 CHECK_DBL( RT_NOCRT(pow)( +INFINITY, +4.0), +INFINITY); /* 20. base == +Inf and exp > 0: Return +Inf */ 2782 CHECK_DBL( RT_NOCRT(pow)( +INFINITY, +4.4), +INFINITY); /* 20. base == +Inf and exp > 0: Return +Inf */ 2783 CHECK_DBL( RT_NOCRT(pow)( +INFINITY, +0.3), +INFINITY); /* 20. base == +Inf and exp > 0: Return +Inf */ 2784 2785 /* Integer exponents: */ 2786 //lvbe /mnt/e/misc/float/pow +1.0 +1.0 +2.0 +1.0 +2.0 +2.0 +2.0 +15.0 +2.0 +42.0 -2.5 +3.0 -2.5 +4.0 -2.5 +16.0 +2.0 -1.0 +2.0 -2.0 +2.0 -3.0 -42.5 -7.0 | clip 2787 CHECK_DBL( RT_NOCRT(pow)( +1.0, +1.0), +1); 2788 CHECK_DBL( RT_NOCRT(pow)( +2.0, +1.0), +2); 2789 CHECK_DBL( RT_NOCRT(pow)( +2.0, +2.0), +4); 2790 CHECK_DBL( RT_NOCRT(pow)( +2.0, +15.0), +32768); 2791 CHECK_DBL( RT_NOCRT(pow)( +2.0, +42.0), +4398046511104); 2792 CHECK_DBL( RT_NOCRT(pow)( -2.5, +3.0), -15.625); 2793 CHECK_DBL( RT_NOCRT(pow)( -2.5, +4.0), +39.0625); 2794 CHECK_DBL( RT_NOCRT(pow)( -2.5, +16.0), +2328306.4365386962891); 2795 CHECK_DBL( RT_NOCRT(pow)( +2.0, -1.0), +0.5); 2796 CHECK_DBL( RT_NOCRT(pow)( +2.0, -2.0), +0.25); 2797 CHECK_DBL( RT_NOCRT(pow)( +2.0, -3.0), +0.125); 2798 /* Fractional exponents: */ 2799 //lvbe /mnt/e/misc/float/pow +2.0 +1.0001 +2.0 +1.5 +2.0 -1.5 +2.0 -1.1 +2.0 -0.98 +2.5 +0.39 +42.424242 +22.34356458 +88888888.9999999e+10 +2.7182818284590452354 +9999387.349569 -2.7182818284590452354| clip 2800 CHECK_DBL( RT_NOCRT(pow)( +2.0, +1.0001), +2.0001386342407529995); 2801 CHECK_DBL( RT_NOCRT(pow)( +2.0, +1.5), +2.8284271247461902909); 2802 CHECK_DBL( RT_NOCRT(pow)( +2.0, -1.5), +0.35355339059327378637); 2803 CHECK_DBL( RT_NOCRT(pow)( +2.0, -1.1), +0.46651649576840370504); 2804 CHECK_DBL( RT_NOCRT(pow)( +2.0, -0.98), +0.50697973989501454728); 2805 CHECK_DBL( RT_NOCRT(pow)( +2.5, +0.39), +1.4295409595509598333); 2806 CHECK_DBL_RANGE(RT_NOCRT(pow)( +42.424242, +22.34356458), +2.3264866447369911544e+36, 0.00000000000001e+36); 2807 CHECK_DBL_RANGE(RT_NOCRT(pow)( +88888888.9999999e+10, +2.7182818284590452354), +6.1663183371503584444e+48, 0.00000000000001e+48); 2808 CHECK_DBL_RANGE(RT_NOCRT(pow)( +9999387.349569, -2.7182818284590452354), +9.3777689533441608684e-20, 0.00000000000001e-20); 2809 2810 } 2710 2811 2711 2812 void testFma() … … 3612 3713 testExp2(); 3613 3714 testLdExp(); 3715 testPow(); 3614 3716 testFma(); 3615 3717 testRemainder();
Note:
See TracChangeset
for help on using the changeset viewer.