Lines Matching full:pi
10 * @brief pi computation portion of FPU sharing test
18 * Testing utilizes a pair of tasks that independently compute pi. The lower
22 * The following formula is used to compute pi:
24 * pi = 4 * (1 - 1/3 + 1/5 - 1/7 + 1/9 - ... )
26 * This series converges to pi very slowly. For example, performing 50,000
29 * A reference value of pi is computed once at the start of the test. All
69 * @brief Entry point for the low priority pi compute task
75 volatile FP_TYPE pi; /* volatile to avoid optimizing out of loop */ in calculate_pi_low() local
84 pi = FP_CONSTANT(1.0); in calculate_pi_low()
88 pi += sign / divisor; in calculate_pi_low()
93 pi *= FP_CONSTANT(4.0); in calculate_pi_low()
96 reference_pi = pi; in calculate_pi_low()
97 } else if (reference_pi != pi) { in calculate_pi_low()
98 printf("Computed pi %1.6f, reference pi %1.6f\n", in calculate_pi_low()
99 (double)pi, (double)reference_pi); in calculate_pi_low()
102 zassert_equal(reference_pi, pi, in calculate_pi_low()
103 "pi computation error"); in calculate_pi_low()
108 * @brief Entry point for the high priority pi compute task
114 volatile FP_TYPE pi; /* volatile to avoid optimizing out of loop */ in calculate_pi_high() local
125 pi = FP_CONSTANT(1.0); in calculate_pi_high()
129 pi += sign / divisor; in calculate_pi_high()
146 pi *= FP_CONSTANT(4.0); in calculate_pi_high()
149 reference_pi = pi; in calculate_pi_high()
150 } else if (reference_pi != pi) { in calculate_pi_high()
151 printf("Computed pi %1.6f, reference pi %1.6f\n", in calculate_pi_high()
152 (double)pi, (double)reference_pi); in calculate_pi_high()
155 zassert_equal(reference_pi, pi, in calculate_pi_high()
156 "pi computation error"); in calculate_pi_high()
160 printf("Pi calculation OK after %u (high) +" in calculate_pi_high()
162 calc_pi_high_count, calc_pi_low_count, (double)pi); in calculate_pi_high()