
(FPCore () :precision binary64 (- 20 (- (exp PI) PI)))
double code() {
return 20.0 - (exp(((double) M_PI)) - ((double) M_PI));
}
public static double code() {
return 20.0 - (Math.exp(Math.PI) - Math.PI);
}
def code(): return 20.0 - (math.exp(math.pi) - math.pi)
function code() return Float64(20.0 - Float64(exp(pi) - pi)) end
function tmp = code() tmp = 20.0 - (exp(pi) - pi); end
code[] := N[(20 - N[(N[Exp[Pi], $MachinePrecision] - Pi), $MachinePrecision]), $MachinePrecision]
20 - \left(e^{\pi} - \pi\right)
Herbie found 1 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore () :precision binary64 (- 20 (- (exp PI) PI)))
double code() {
return 20.0 - (exp(((double) M_PI)) - ((double) M_PI));
}
public static double code() {
return 20.0 - (Math.exp(Math.PI) - Math.PI);
}
def code(): return 20.0 - (math.exp(math.pi) - math.pi)
function code() return Float64(20.0 - Float64(exp(pi) - pi)) end
function tmp = code() tmp = 20.0 - (exp(pi) - pi); end
code[] := N[(20 - N[(N[Exp[Pi], $MachinePrecision] - Pi), $MachinePrecision]), $MachinePrecision]
20 - \left(e^{\pi} - \pi\right)
herbie shell --seed 2025326 -o generate:taylor -o generate:evaluate
(FPCore ()
:name "xkcd217 (a numerical coincidence)"
:precision binary64
(- 20 (- (exp PI) PI)))