
(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + (y * (z - x))) / z
end function
public static double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
def code(x, y, z): return (x + (y * (z - x))) / z
function code(x, y, z) return Float64(Float64(x + Float64(y * Float64(z - x))) / z) end
function tmp = code(x, y, z) tmp = (x + (y * (z - x))) / z; end
code[x_, y_, z_] := N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y \cdot \left(z - x\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (+ x (* y (- z x))) z))
double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + (y * (z - x))) / z
end function
public static double code(double x, double y, double z) {
return (x + (y * (z - x))) / z;
}
def code(x, y, z): return (x + (y * (z - x))) / z
function code(x, y, z) return Float64(Float64(x + Float64(y * Float64(z - x))) / z) end
function tmp = code(x, y, z) tmp = (x + (y * (z - x))) / z; end
code[x_, y_, z_] := N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + y \cdot \left(z - x\right)}{z}
\end{array}
(FPCore (x y z) :precision binary64 (+ y (/ (+ y -1.0) (/ (- z) x))))
double code(double x, double y, double z) {
return y + ((y + -1.0) / (-z / x));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y + ((y + (-1.0d0)) / (-z / x))
end function
public static double code(double x, double y, double z) {
return y + ((y + -1.0) / (-z / x));
}
def code(x, y, z): return y + ((y + -1.0) / (-z / x))
function code(x, y, z) return Float64(y + Float64(Float64(y + -1.0) / Float64(Float64(-z) / x))) end
function tmp = code(x, y, z) tmp = y + ((y + -1.0) / (-z / x)); end
code[x_, y_, z_] := N[(y + N[(N[(y + -1.0), $MachinePrecision] / N[((-z) / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y + \frac{y + -1}{\frac{-z}{x}}
\end{array}
Initial program 90.8%
Taylor expanded in x around inf 97.3%
frac-2neg97.3%
div-inv97.2%
Applied egg-rr97.2%
associate-*r/97.3%
*-rgt-identity97.3%
*-commutative97.3%
associate-/l*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -6.5e+102) (not (<= z 1.5e+143))) (+ y (/ x z)) (/ (+ x (* y (- z x))) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.5e+102) || !(z <= 1.5e+143)) {
tmp = y + (x / z);
} else {
tmp = (x + (y * (z - x))) / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-6.5d+102)) .or. (.not. (z <= 1.5d+143))) then
tmp = y + (x / z)
else
tmp = (x + (y * (z - x))) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -6.5e+102) || !(z <= 1.5e+143)) {
tmp = y + (x / z);
} else {
tmp = (x + (y * (z - x))) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.5e+102) or not (z <= 1.5e+143): tmp = y + (x / z) else: tmp = (x + (y * (z - x))) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.5e+102) || !(z <= 1.5e+143)) tmp = Float64(y + Float64(x / z)); else tmp = Float64(Float64(x + Float64(y * Float64(z - x))) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6.5e+102) || ~((z <= 1.5e+143))) tmp = y + (x / z); else tmp = (x + (y * (z - x))) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.5e+102], N[Not[LessEqual[z, 1.5e+143]], $MachinePrecision]], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{+102} \lor \neg \left(z \leq 1.5 \cdot 10^{+143}\right):\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + y \cdot \left(z - x\right)}{z}\\
\end{array}
\end{array}
if z < -6.5000000000000004e102 or 1.5e143 < z Initial program 72.5%
Taylor expanded in z around inf 68.8%
Taylor expanded in x around 0 93.3%
+-commutative93.3%
Simplified93.3%
if -6.5000000000000004e102 < z < 1.5e143Initial program 99.3%
Final simplification97.4%
(FPCore (x y z) :precision binary64 (if (or (<= x -9e-15) (not (<= x 1.02e+34))) (* x (/ (- 1.0 y) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -9e-15) || !(x <= 1.02e+34)) {
tmp = x * ((1.0 - y) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-9d-15)) .or. (.not. (x <= 1.02d+34))) then
tmp = x * ((1.0d0 - y) / z)
else
tmp = y + (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -9e-15) || !(x <= 1.02e+34)) {
tmp = x * ((1.0 - y) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -9e-15) or not (x <= 1.02e+34): tmp = x * ((1.0 - y) / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -9e-15) || !(x <= 1.02e+34)) tmp = Float64(x * Float64(Float64(1.0 - y) / z)); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -9e-15) || ~((x <= 1.02e+34))) tmp = x * ((1.0 - y) / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -9e-15], N[Not[LessEqual[x, 1.02e+34]], $MachinePrecision]], N[(x * N[(N[(1.0 - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{-15} \lor \neg \left(x \leq 1.02 \cdot 10^{+34}\right):\\
\;\;\;\;x \cdot \frac{1 - y}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if x < -8.9999999999999995e-15 or 1.02e34 < x Initial program 92.3%
Taylor expanded in x around inf 84.9%
associate-/l*87.2%
associate-/r/87.1%
mul-1-neg87.1%
unsub-neg87.1%
Simplified87.1%
if -8.9999999999999995e-15 < x < 1.02e34Initial program 89.3%
Taylor expanded in z around inf 78.6%
Taylor expanded in x around 0 89.3%
+-commutative89.3%
Simplified89.3%
Final simplification88.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (- y (* x (/ y z))) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = y - (x * (y / z));
} else {
tmp = y + (x / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-1.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = y - (x * (y / z))
else
tmp = y + (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = y - (x * (y / z));
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.0) or not (y <= 1.0): tmp = y - (x * (y / z)) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(y - Float64(x * Float64(y / z))); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.0) || ~((y <= 1.0))) tmp = y - (x * (y / z)); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(y - N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;y - x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 80.7%
Taylor expanded in x around inf 94.4%
Taylor expanded in y around inf 98.0%
distribute-lft-in98.1%
*-commutative98.1%
associate-*r*98.1%
associate-*r/92.6%
*-commutative92.6%
*-rgt-identity92.6%
mul-1-neg92.6%
unsub-neg92.6%
associate-*l/90.4%
*-commutative90.4%
Simplified90.4%
if -1 < y < 1Initial program 100.0%
Taylor expanded in z around inf 99.5%
Taylor expanded in x around 0 99.5%
+-commutative99.5%
Simplified99.5%
Final simplification95.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (- y (/ (* y x) z)) (+ y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = y - ((y * x) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-1.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = y - ((y * x) / z)
else
tmp = y + (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = y - ((y * x) / z);
} else {
tmp = y + (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.0) or not (y <= 1.0): tmp = y - ((y * x) / z) else: tmp = y + (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(y - Float64(Float64(y * x) / z)); else tmp = Float64(y + Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.0) || ~((y <= 1.0))) tmp = y - ((y * x) / z); else tmp = y + (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(y - N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;y - \frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;y + \frac{x}{z}\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 80.7%
Taylor expanded in x around inf 94.4%
Taylor expanded in y around inf 98.0%
distribute-lft-in98.1%
*-commutative98.1%
associate-*r*98.1%
associate-*r/92.6%
*-commutative92.6%
*-rgt-identity92.6%
mul-1-neg92.6%
unsub-neg92.6%
associate-*l/90.4%
*-commutative90.4%
Simplified90.4%
Taylor expanded in x around 0 92.6%
if -1 < y < 1Initial program 100.0%
Taylor expanded in z around inf 99.5%
Taylor expanded in x around 0 99.5%
+-commutative99.5%
Simplified99.5%
Final simplification96.2%
(FPCore (x y z) :precision binary64 (if (<= y 30.0) (+ y (/ x z)) (if (<= y 8.6e+162) (/ (- y) (/ z x)) (- y (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 30.0) {
tmp = y + (x / z);
} else if (y <= 8.6e+162) {
tmp = -y / (z / x);
} else {
tmp = y - (x / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 30.0d0) then
tmp = y + (x / z)
else if (y <= 8.6d+162) then
tmp = -y / (z / x)
else
tmp = y - (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 30.0) {
tmp = y + (x / z);
} else if (y <= 8.6e+162) {
tmp = -y / (z / x);
} else {
tmp = y - (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 30.0: tmp = y + (x / z) elif y <= 8.6e+162: tmp = -y / (z / x) else: tmp = y - (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 30.0) tmp = Float64(y + Float64(x / z)); elseif (y <= 8.6e+162) tmp = Float64(Float64(-y) / Float64(z / x)); else tmp = Float64(y - Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 30.0) tmp = y + (x / z); elseif (y <= 8.6e+162) tmp = -y / (z / x); else tmp = y - (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 30.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.6e+162], N[((-y) / N[(z / x), $MachinePrecision]), $MachinePrecision], N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 30:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{elif}\;y \leq 8.6 \cdot 10^{+162}:\\
\;\;\;\;\frac{-y}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;y - \frac{x}{z}\\
\end{array}
\end{array}
if y < 30Initial program 94.1%
Taylor expanded in z around inf 84.5%
Taylor expanded in x around 0 90.1%
+-commutative90.1%
Simplified90.1%
if 30 < y < 8.6000000000000004e162Initial program 86.1%
Taylor expanded in x around inf 62.1%
*-commutative62.1%
associate-/l*58.4%
mul-1-neg58.4%
unsub-neg58.4%
Simplified58.4%
Taylor expanded in y around inf 54.3%
associate-*r/54.3%
neg-mul-154.3%
Simplified54.3%
frac-2neg54.3%
div-inv53.5%
distribute-frac-neg53.5%
remove-double-neg53.5%
clear-num53.4%
Applied egg-rr53.4%
*-commutative53.4%
distribute-rgt-neg-out53.4%
associate-/r/63.2%
distribute-neg-frac63.2%
Applied egg-rr63.2%
if 8.6000000000000004e162 < y Initial program 73.7%
Taylor expanded in z around inf 28.2%
Taylor expanded in x around 0 51.2%
+-commutative51.2%
Simplified51.2%
div-inv51.2%
fma-def51.2%
frac-2neg51.2%
metadata-eval51.2%
add-sqr-sqrt22.4%
sqrt-unprod54.6%
sqr-neg54.6%
sqrt-unprod32.4%
add-sqr-sqrt69.1%
Applied egg-rr69.1%
fma-udef69.1%
*-commutative69.1%
associate-*l/69.1%
associate-*r/69.1%
mul-1-neg69.1%
+-commutative69.1%
sub-neg69.1%
Simplified69.1%
Final simplification84.1%
(FPCore (x y z) :precision binary64 (if (<= z -450000000.0) y (if (<= z 8.4e+82) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (z <= -450000000.0) {
tmp = y;
} else if (z <= 8.4e+82) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-450000000.0d0)) then
tmp = y
else if (z <= 8.4d+82) then
tmp = x / z
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -450000000.0) {
tmp = y;
} else if (z <= 8.4e+82) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -450000000.0: tmp = y elif z <= 8.4e+82: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (z <= -450000000.0) tmp = y; elseif (z <= 8.4e+82) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -450000000.0) tmp = y; elseif (z <= 8.4e+82) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -450000000.0], y, If[LessEqual[z, 8.4e+82], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -450000000:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 8.4 \cdot 10^{+82}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if z < -4.5e8 or 8.4000000000000001e82 < z Initial program 79.3%
Taylor expanded in x around 0 74.6%
if -4.5e8 < z < 8.4000000000000001e82Initial program 99.3%
Taylor expanded in y around 0 56.3%
Final simplification64.1%
(FPCore (x y z) :precision binary64 (if (<= y 1.0) (+ y (/ x z)) (- y (/ x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.0) {
tmp = y + (x / z);
} else {
tmp = y - (x / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 1.0d0) then
tmp = y + (x / z)
else
tmp = y - (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.0) {
tmp = y + (x / z);
} else {
tmp = y - (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.0: tmp = y + (x / z) else: tmp = y - (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.0) tmp = Float64(y + Float64(x / z)); else tmp = Float64(y - Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.0) tmp = y + (x / z); else tmp = y - (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1:\\
\;\;\;\;y + \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y - \frac{x}{z}\\
\end{array}
\end{array}
if y < 1Initial program 94.1%
Taylor expanded in z around inf 84.5%
Taylor expanded in x around 0 90.1%
+-commutative90.1%
Simplified90.1%
if 1 < y Initial program 80.6%
Taylor expanded in z around inf 26.4%
Taylor expanded in x around 0 41.2%
+-commutative41.2%
Simplified41.2%
div-inv41.2%
fma-def41.2%
frac-2neg41.2%
metadata-eval41.2%
add-sqr-sqrt23.3%
sqrt-unprod47.7%
sqr-neg47.7%
sqrt-unprod22.1%
add-sqr-sqrt58.6%
Applied egg-rr58.6%
fma-udef58.6%
*-commutative58.6%
associate-*l/58.6%
associate-*r/58.6%
mul-1-neg58.6%
+-commutative58.6%
sub-neg58.6%
Simplified58.6%
Final simplification82.3%
(FPCore (x y z) :precision binary64 (+ y (/ x z)))
double code(double x, double y, double z) {
return y + (x / z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y + (x / z)
end function
public static double code(double x, double y, double z) {
return y + (x / z);
}
def code(x, y, z): return y + (x / z)
function code(x, y, z) return Float64(y + Float64(x / z)) end
function tmp = code(x, y, z) tmp = y + (x / z); end
code[x_, y_, z_] := N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y + \frac{x}{z}
\end{array}
Initial program 90.8%
Taylor expanded in z around inf 70.2%
Taylor expanded in x around 0 78.1%
+-commutative78.1%
Simplified78.1%
Final simplification78.1%
(FPCore (x y z) :precision binary64 y)
double code(double x, double y, double z) {
return y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y
end function
public static double code(double x, double y, double z) {
return y;
}
def code(x, y, z): return y
function code(x, y, z) return y end
function tmp = code(x, y, z) tmp = y; end
code[x_, y_, z_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 90.8%
Taylor expanded in x around 0 40.2%
Final simplification40.2%
(FPCore (x y z) :precision binary64 (- (+ y (/ x z)) (/ y (/ z x))))
double code(double x, double y, double z) {
return (y + (x / z)) - (y / (z / x));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (y + (x / z)) - (y / (z / x))
end function
public static double code(double x, double y, double z) {
return (y + (x / z)) - (y / (z / x));
}
def code(x, y, z): return (y + (x / z)) - (y / (z / x))
function code(x, y, z) return Float64(Float64(y + Float64(x / z)) - Float64(y / Float64(z / x))) end
function tmp = code(x, y, z) tmp = (y + (x / z)) - (y / (z / x)); end
code[x_, y_, z_] := N[(N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision] - N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(y + \frac{x}{z}\right) - \frac{y}{\frac{z}{x}}
\end{array}
herbie shell --seed 2023221
(FPCore (x y z)
:name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
:precision binary64
:herbie-target
(- (+ y (/ x z)) (/ y (/ z x)))
(/ (+ x (* y (- z x))) z))