File size: 427 Bytes
42ef9b5
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
"""CPU-only verification test for Flint Hills Series"""
print("Testing flint-hills-cuda...")
import math
S10 = sum(1.0 / (n**3 * math.sin(n)**2) for n in range(1, 11))
print(f"  S_10 = {S10:.6f}")
assert 3.0 < S10 < 4.0, f"S_10 out of expected range: {S10}"
S100 = sum(1.0 / (n**3 * math.sin(n)**2) for n in range(1, 101))
print(f"  S_100 = {S100:.6f}")
assert S100 > S10, "S_100 should be > S_10"
print(f"\n2/2 tests passed")