mirror of
https://github.com/zenlm/zen-coder.git
synced 2026-11-10 21:30:01 +00:00
12 lines
377 B
Python
12 lines
377 B
Python
"""Special oracle handlings for problems where direct differential testing is not applicable."""
|
|
|
|
import math
|
|
|
|
# oracle for HumaneEval/032
|
|
def _poly(xs: list, x: float):
|
|
"""
|
|
Evaluates polynomial with coefficients xs at point x.
|
|
return xs[0] + xs[1] * x + xs[1] * x^2 + .... xs[n] * x^n
|
|
"""
|
|
return sum([coeff * math.pow(x, i) for i, coeff in enumerate(xs)])
|