
(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 11 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 (if (<= y -4e+27) (- y (/ y (/ z x))) (+ y (* x (/ (- 1.0 y) z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4e+27) {
tmp = y - (y / (z / x));
} else {
tmp = y + (x * ((1.0 - y) / 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 <= (-4d+27)) then
tmp = y - (y / (z / x))
else
tmp = y + (x * ((1.0d0 - y) / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4e+27) {
tmp = y - (y / (z / x));
} else {
tmp = y + (x * ((1.0 - y) / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4e+27: tmp = y - (y / (z / x)) else: tmp = y + (x * ((1.0 - y) / z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4e+27) tmp = Float64(y - Float64(y / Float64(z / x))); else tmp = Float64(y + Float64(x * Float64(Float64(1.0 - y) / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4e+27) tmp = y - (y / (z / x)); else tmp = y + (x * ((1.0 - y) / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4e+27], N[(y - N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + N[(x * N[(N[(1.0 - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{+27}:\\
\;\;\;\;y - \frac{y}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;y + x \cdot \frac{1 - y}{z}\\
\end{array}
\end{array}
if y < -4.0000000000000001e27Initial program 74.6%
Taylor expanded in x around inf 77.0%
associate-+r+77.0%
+-commutative77.0%
mul-1-neg77.0%
unsub-neg77.0%
div-sub77.0%
Simplified77.0%
Taylor expanded in x around 0 88.0%
div-sub88.0%
Simplified88.0%
Taylor expanded in y around inf 87.8%
associate-*l/99.9%
associate-*l*99.9%
*-commutative99.9%
associate-*l*99.9%
neg-mul-199.9%
Simplified99.9%
distribute-rgt-neg-out99.9%
distribute-lft-neg-in99.9%
add-sqr-sqrt0.0%
sqrt-unprod22.4%
sqr-neg22.4%
sqrt-unprod52.7%
add-sqr-sqrt52.7%
cancel-sign-sub-inv52.7%
*-commutative52.7%
clear-num52.7%
un-div-inv52.7%
add-sqr-sqrt52.7%
sqrt-unprod22.4%
sqr-neg22.4%
sqrt-unprod0.0%
add-sqr-sqrt99.9%
Applied egg-rr99.9%
if -4.0000000000000001e27 < y Initial program 91.8%
Taylor expanded in x around inf 90.6%
associate-+r+90.6%
+-commutative90.6%
mul-1-neg90.6%
unsub-neg90.6%
div-sub90.6%
Simplified90.6%
Taylor expanded in x around 0 97.8%
div-sub97.8%
Simplified97.8%
Final simplification98.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (/ x (- z)))))
(if (<= y -5.2e+229)
y
(if (<= y -7.2e+199)
t_0
(if (<= y -5e+93)
(/ z (/ z y))
(if (<= y -2600000000.0)
t_0
(if (<= y -1.45e-14)
y
(if (<= y 9.5e-15)
(/ x z)
(if (<= y 3.6e+228) y (* x (/ y (- z))))))))))))
double code(double x, double y, double z) {
double t_0 = y * (x / -z);
double tmp;
if (y <= -5.2e+229) {
tmp = y;
} else if (y <= -7.2e+199) {
tmp = t_0;
} else if (y <= -5e+93) {
tmp = z / (z / y);
} else if (y <= -2600000000.0) {
tmp = t_0;
} else if (y <= -1.45e-14) {
tmp = y;
} else if (y <= 9.5e-15) {
tmp = x / z;
} else if (y <= 3.6e+228) {
tmp = y;
} else {
tmp = x * (y / -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) :: t_0
real(8) :: tmp
t_0 = y * (x / -z)
if (y <= (-5.2d+229)) then
tmp = y
else if (y <= (-7.2d+199)) then
tmp = t_0
else if (y <= (-5d+93)) then
tmp = z / (z / y)
else if (y <= (-2600000000.0d0)) then
tmp = t_0
else if (y <= (-1.45d-14)) then
tmp = y
else if (y <= 9.5d-15) then
tmp = x / z
else if (y <= 3.6d+228) then
tmp = y
else
tmp = x * (y / -z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (x / -z);
double tmp;
if (y <= -5.2e+229) {
tmp = y;
} else if (y <= -7.2e+199) {
tmp = t_0;
} else if (y <= -5e+93) {
tmp = z / (z / y);
} else if (y <= -2600000000.0) {
tmp = t_0;
} else if (y <= -1.45e-14) {
tmp = y;
} else if (y <= 9.5e-15) {
tmp = x / z;
} else if (y <= 3.6e+228) {
tmp = y;
} else {
tmp = x * (y / -z);
}
return tmp;
}
def code(x, y, z): t_0 = y * (x / -z) tmp = 0 if y <= -5.2e+229: tmp = y elif y <= -7.2e+199: tmp = t_0 elif y <= -5e+93: tmp = z / (z / y) elif y <= -2600000000.0: tmp = t_0 elif y <= -1.45e-14: tmp = y elif y <= 9.5e-15: tmp = x / z elif y <= 3.6e+228: tmp = y else: tmp = x * (y / -z) return tmp
function code(x, y, z) t_0 = Float64(y * Float64(x / Float64(-z))) tmp = 0.0 if (y <= -5.2e+229) tmp = y; elseif (y <= -7.2e+199) tmp = t_0; elseif (y <= -5e+93) tmp = Float64(z / Float64(z / y)); elseif (y <= -2600000000.0) tmp = t_0; elseif (y <= -1.45e-14) tmp = y; elseif (y <= 9.5e-15) tmp = Float64(x / z); elseif (y <= 3.6e+228) tmp = y; else tmp = Float64(x * Float64(y / Float64(-z))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (x / -z); tmp = 0.0; if (y <= -5.2e+229) tmp = y; elseif (y <= -7.2e+199) tmp = t_0; elseif (y <= -5e+93) tmp = z / (z / y); elseif (y <= -2600000000.0) tmp = t_0; elseif (y <= -1.45e-14) tmp = y; elseif (y <= 9.5e-15) tmp = x / z; elseif (y <= 3.6e+228) tmp = y; else tmp = x * (y / -z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / (-z)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.2e+229], y, If[LessEqual[y, -7.2e+199], t$95$0, If[LessEqual[y, -5e+93], N[(z / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2600000000.0], t$95$0, If[LessEqual[y, -1.45e-14], y, If[LessEqual[y, 9.5e-15], N[(x / z), $MachinePrecision], If[LessEqual[y, 3.6e+228], y, N[(x * N[(y / (-z)), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{x}{-z}\\
\mathbf{if}\;y \leq -5.2 \cdot 10^{+229}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq -7.2 \cdot 10^{+199}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -5 \cdot 10^{+93}:\\
\;\;\;\;\frac{z}{\frac{z}{y}}\\
\mathbf{elif}\;y \leq -2600000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -1.45 \cdot 10^{-14}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{-15}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{+228}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{-z}\\
\end{array}
\end{array}
if y < -5.2e229 or -2.6e9 < y < -1.4500000000000001e-14 or 9.5000000000000005e-15 < y < 3.6e228Initial program 79.5%
Taylor expanded in x around 0 62.6%
if -5.2e229 < y < -7.20000000000000002e199 or -5.0000000000000001e93 < y < -2.6e9Initial program 88.2%
Taylor expanded in x around inf 62.5%
associate-/l*59.5%
mul-1-neg59.5%
unsub-neg59.5%
Simplified59.5%
Taylor expanded in y around inf 61.0%
associate-*l/98.4%
associate-*l*98.4%
*-commutative98.4%
associate-*l*98.4%
neg-mul-198.4%
Simplified66.2%
if -7.20000000000000002e199 < y < -5.0000000000000001e93Initial program 61.8%
Taylor expanded in x around 0 37.9%
*-commutative37.9%
associate-/l*71.6%
Applied egg-rr71.6%
clear-num71.5%
un-div-inv71.7%
Applied egg-rr71.7%
if -1.4500000000000001e-14 < y < 9.5000000000000005e-15Initial program 100.0%
Taylor expanded in y around 0 79.6%
if 3.6e228 < y Initial program 74.8%
Taylor expanded in x around inf 62.7%
associate-/l*68.2%
mul-1-neg68.2%
unsub-neg68.2%
Simplified68.2%
Taylor expanded in y around inf 68.2%
neg-mul-168.2%
distribute-neg-frac268.2%
Simplified68.2%
Final simplification71.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (/ y (- z)))))
(if (<= y -4.8e+93)
y
(if (<= y -30000000000.0)
t_0
(if (<= y -5.6e-16)
y
(if (<= y 1.3e-25) (/ x z) (if (<= y 1.75e+226) y t_0)))))))
double code(double x, double y, double z) {
double t_0 = x * (y / -z);
double tmp;
if (y <= -4.8e+93) {
tmp = y;
} else if (y <= -30000000000.0) {
tmp = t_0;
} else if (y <= -5.6e-16) {
tmp = y;
} else if (y <= 1.3e-25) {
tmp = x / z;
} else if (y <= 1.75e+226) {
tmp = y;
} else {
tmp = t_0;
}
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) :: t_0
real(8) :: tmp
t_0 = x * (y / -z)
if (y <= (-4.8d+93)) then
tmp = y
else if (y <= (-30000000000.0d0)) then
tmp = t_0
else if (y <= (-5.6d-16)) then
tmp = y
else if (y <= 1.3d-25) then
tmp = x / z
else if (y <= 1.75d+226) then
tmp = y
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (y / -z);
double tmp;
if (y <= -4.8e+93) {
tmp = y;
} else if (y <= -30000000000.0) {
tmp = t_0;
} else if (y <= -5.6e-16) {
tmp = y;
} else if (y <= 1.3e-25) {
tmp = x / z;
} else if (y <= 1.75e+226) {
tmp = y;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (y / -z) tmp = 0 if y <= -4.8e+93: tmp = y elif y <= -30000000000.0: tmp = t_0 elif y <= -5.6e-16: tmp = y elif y <= 1.3e-25: tmp = x / z elif y <= 1.75e+226: tmp = y else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(y / Float64(-z))) tmp = 0.0 if (y <= -4.8e+93) tmp = y; elseif (y <= -30000000000.0) tmp = t_0; elseif (y <= -5.6e-16) tmp = y; elseif (y <= 1.3e-25) tmp = Float64(x / z); elseif (y <= 1.75e+226) tmp = y; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (y / -z); tmp = 0.0; if (y <= -4.8e+93) tmp = y; elseif (y <= -30000000000.0) tmp = t_0; elseif (y <= -5.6e-16) tmp = y; elseif (y <= 1.3e-25) tmp = x / z; elseif (y <= 1.75e+226) tmp = y; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(y / (-z)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.8e+93], y, If[LessEqual[y, -30000000000.0], t$95$0, If[LessEqual[y, -5.6e-16], y, If[LessEqual[y, 1.3e-25], N[(x / z), $MachinePrecision], If[LessEqual[y, 1.75e+226], y, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{y}{-z}\\
\mathbf{if}\;y \leq -4.8 \cdot 10^{+93}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq -30000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -5.6 \cdot 10^{-16}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-25}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{+226}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -4.80000000000000021e93 or -3e10 < y < -5.6000000000000003e-16 or 1.3e-25 < y < 1.7499999999999999e226Initial program 77.1%
Taylor expanded in x around 0 60.6%
if -4.80000000000000021e93 < y < -3e10 or 1.7499999999999999e226 < y Initial program 80.0%
Taylor expanded in x around inf 60.9%
associate-/l*65.2%
mul-1-neg65.2%
unsub-neg65.2%
Simplified65.2%
Taylor expanded in y around inf 64.0%
neg-mul-164.0%
distribute-neg-frac264.0%
Simplified64.0%
if -5.6000000000000003e-16 < y < 1.3e-25Initial program 100.0%
Taylor expanded in y around 0 79.6%
Final simplification69.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (/ (- 1.0 y) z))))
(if (<= z -4.5e+109)
y
(if (<= z -3.6e+31)
t_0
(if (<= z -2.75e-14) (/ (* y z) z) (if (<= z 3.4e+120) t_0 y))))))
double code(double x, double y, double z) {
double t_0 = x * ((1.0 - y) / z);
double tmp;
if (z <= -4.5e+109) {
tmp = y;
} else if (z <= -3.6e+31) {
tmp = t_0;
} else if (z <= -2.75e-14) {
tmp = (y * z) / z;
} else if (z <= 3.4e+120) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = x * ((1.0d0 - y) / z)
if (z <= (-4.5d+109)) then
tmp = y
else if (z <= (-3.6d+31)) then
tmp = t_0
else if (z <= (-2.75d-14)) then
tmp = (y * z) / z
else if (z <= 3.4d+120) then
tmp = t_0
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * ((1.0 - y) / z);
double tmp;
if (z <= -4.5e+109) {
tmp = y;
} else if (z <= -3.6e+31) {
tmp = t_0;
} else if (z <= -2.75e-14) {
tmp = (y * z) / z;
} else if (z <= 3.4e+120) {
tmp = t_0;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): t_0 = x * ((1.0 - y) / z) tmp = 0 if z <= -4.5e+109: tmp = y elif z <= -3.6e+31: tmp = t_0 elif z <= -2.75e-14: tmp = (y * z) / z elif z <= 3.4e+120: tmp = t_0 else: tmp = y return tmp
function code(x, y, z) t_0 = Float64(x * Float64(Float64(1.0 - y) / z)) tmp = 0.0 if (z <= -4.5e+109) tmp = y; elseif (z <= -3.6e+31) tmp = t_0; elseif (z <= -2.75e-14) tmp = Float64(Float64(y * z) / z); elseif (z <= 3.4e+120) tmp = t_0; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * ((1.0 - y) / z); tmp = 0.0; if (z <= -4.5e+109) tmp = y; elseif (z <= -3.6e+31) tmp = t_0; elseif (z <= -2.75e-14) tmp = (y * z) / z; elseif (z <= 3.4e+120) tmp = t_0; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(N[(1.0 - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.5e+109], y, If[LessEqual[z, -3.6e+31], t$95$0, If[LessEqual[z, -2.75e-14], N[(N[(y * z), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 3.4e+120], t$95$0, y]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{1 - y}{z}\\
\mathbf{if}\;z \leq -4.5 \cdot 10^{+109}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{+31}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -2.75 \cdot 10^{-14}:\\
\;\;\;\;\frac{y \cdot z}{z}\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{+120}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if z < -4.4999999999999996e109 or 3.39999999999999999e120 < z Initial program 63.6%
Taylor expanded in x around 0 74.5%
if -4.4999999999999996e109 < z < -3.59999999999999996e31 or -2.74999999999999996e-14 < z < 3.39999999999999999e120Initial program 97.1%
Taylor expanded in x around inf 77.2%
associate-/l*77.1%
mul-1-neg77.1%
unsub-neg77.1%
Simplified77.1%
if -3.59999999999999996e31 < z < -2.74999999999999996e-14Initial program 99.7%
Taylor expanded in x around 0 72.0%
Final simplification76.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -6.5e-36) (not (<= y 9.8e-17))) (* y (- 1.0 (/ x z))) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6.5e-36) || !(y <= 9.8e-17)) {
tmp = y * (1.0 - (x / z));
} else {
tmp = 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 <= (-6.5d-36)) .or. (.not. (y <= 9.8d-17))) then
tmp = y * (1.0d0 - (x / z))
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -6.5e-36) || !(y <= 9.8e-17)) {
tmp = y * (1.0 - (x / z));
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6.5e-36) or not (y <= 9.8e-17): tmp = y * (1.0 - (x / z)) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6.5e-36) || !(y <= 9.8e-17)) tmp = Float64(y * Float64(1.0 - Float64(x / z))); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -6.5e-36) || ~((y <= 9.8e-17))) tmp = y * (1.0 - (x / z)); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6.5e-36], N[Not[LessEqual[y, 9.8e-17]], $MachinePrecision]], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{-36} \lor \neg \left(y \leq 9.8 \cdot 10^{-17}\right):\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -6.50000000000000012e-36 or 9.80000000000000024e-17 < y Initial program 78.2%
Taylor expanded in y around inf 77.1%
associate-/l*98.8%
div-sub98.8%
*-inverses98.8%
Simplified98.8%
if -6.50000000000000012e-36 < y < 9.80000000000000024e-17Initial program 100.0%
Taylor expanded in y around 0 80.2%
Final simplification91.2%
(FPCore (x y z) :precision binary64 (if (<= y -1.5e-35) (- y (/ y (/ z x))) (if (<= y 2.55e-17) (/ x z) (* y (- 1.0 (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.5e-35) {
tmp = y - (y / (z / x));
} else if (y <= 2.55e-17) {
tmp = x / z;
} else {
tmp = y * (1.0 - (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.5d-35)) then
tmp = y - (y / (z / x))
else if (y <= 2.55d-17) then
tmp = x / z
else
tmp = y * (1.0d0 - (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.5e-35) {
tmp = y - (y / (z / x));
} else if (y <= 2.55e-17) {
tmp = x / z;
} else {
tmp = y * (1.0 - (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.5e-35: tmp = y - (y / (z / x)) elif y <= 2.55e-17: tmp = x / z else: tmp = y * (1.0 - (x / z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.5e-35) tmp = Float64(y - Float64(y / Float64(z / x))); elseif (y <= 2.55e-17) tmp = Float64(x / z); else tmp = Float64(y * Float64(1.0 - Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.5e-35) tmp = y - (y / (z / x)); elseif (y <= 2.55e-17) tmp = x / z; else tmp = y * (1.0 - (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.5e-35], N[(y - N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.55e-17], N[(x / z), $MachinePrecision], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{-35}:\\
\;\;\;\;y - \frac{y}{\frac{z}{x}}\\
\mathbf{elif}\;y \leq 2.55 \cdot 10^{-17}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\end{array}
\end{array}
if y < -1.49999999999999994e-35Initial program 78.2%
Taylor expanded in x around inf 80.3%
associate-+r+80.3%
+-commutative80.3%
mul-1-neg80.3%
unsub-neg80.3%
div-sub80.3%
Simplified80.3%
Taylor expanded in x around 0 89.8%
div-sub89.8%
Simplified89.8%
Taylor expanded in y around inf 88.0%
associate-*l/98.4%
associate-*l*98.4%
*-commutative98.4%
associate-*l*98.4%
neg-mul-198.4%
Simplified98.4%
distribute-rgt-neg-out98.4%
distribute-lft-neg-in98.4%
add-sqr-sqrt0.0%
sqrt-unprod27.6%
sqr-neg27.6%
sqrt-unprod53.5%
add-sqr-sqrt53.5%
cancel-sign-sub-inv53.5%
*-commutative53.5%
clear-num53.5%
un-div-inv53.5%
add-sqr-sqrt53.5%
sqrt-unprod27.6%
sqr-neg27.6%
sqrt-unprod0.0%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
if -1.49999999999999994e-35 < y < 2.5500000000000001e-17Initial program 100.0%
Taylor expanded in y around 0 80.2%
if 2.5500000000000001e-17 < y Initial program 78.2%
Taylor expanded in y around inf 77.7%
associate-/l*99.4%
div-sub99.4%
*-inverses99.4%
Simplified99.4%
Final simplification91.3%
(FPCore (x y z) :precision binary64 (if (<= y -8e-32) (- y (/ y (/ z x))) (if (<= y 2.4e-18) (/ (* x (- 1.0 y)) z) (* y (- 1.0 (/ x z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -8e-32) {
tmp = y - (y / (z / x));
} else if (y <= 2.4e-18) {
tmp = (x * (1.0 - y)) / z;
} else {
tmp = y * (1.0 - (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 <= (-8d-32)) then
tmp = y - (y / (z / x))
else if (y <= 2.4d-18) then
tmp = (x * (1.0d0 - y)) / z
else
tmp = y * (1.0d0 - (x / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -8e-32) {
tmp = y - (y / (z / x));
} else if (y <= 2.4e-18) {
tmp = (x * (1.0 - y)) / z;
} else {
tmp = y * (1.0 - (x / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -8e-32: tmp = y - (y / (z / x)) elif y <= 2.4e-18: tmp = (x * (1.0 - y)) / z else: tmp = y * (1.0 - (x / z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -8e-32) tmp = Float64(y - Float64(y / Float64(z / x))); elseif (y <= 2.4e-18) tmp = Float64(Float64(x * Float64(1.0 - y)) / z); else tmp = Float64(y * Float64(1.0 - Float64(x / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -8e-32) tmp = y - (y / (z / x)); elseif (y <= 2.4e-18) tmp = (x * (1.0 - y)) / z; else tmp = y * (1.0 - (x / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -8e-32], N[(y - N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.4e-18], N[(N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{-32}:\\
\;\;\;\;y - \frac{y}{\frac{z}{x}}\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{-18}:\\
\;\;\;\;\frac{x \cdot \left(1 - y\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\
\end{array}
\end{array}
if y < -8.00000000000000045e-32Initial program 78.2%
Taylor expanded in x around inf 80.3%
associate-+r+80.3%
+-commutative80.3%
mul-1-neg80.3%
unsub-neg80.3%
div-sub80.3%
Simplified80.3%
Taylor expanded in x around 0 89.8%
div-sub89.8%
Simplified89.8%
Taylor expanded in y around inf 88.0%
associate-*l/98.4%
associate-*l*98.4%
*-commutative98.4%
associate-*l*98.4%
neg-mul-198.4%
Simplified98.4%
distribute-rgt-neg-out98.4%
distribute-lft-neg-in98.4%
add-sqr-sqrt0.0%
sqrt-unprod27.6%
sqr-neg27.6%
sqrt-unprod53.5%
add-sqr-sqrt53.5%
cancel-sign-sub-inv53.5%
*-commutative53.5%
clear-num53.5%
un-div-inv53.5%
add-sqr-sqrt53.5%
sqrt-unprod27.6%
sqr-neg27.6%
sqrt-unprod0.0%
add-sqr-sqrt98.4%
Applied egg-rr98.4%
if -8.00000000000000045e-32 < y < 2.39999999999999994e-18Initial program 100.0%
Taylor expanded in x around inf 80.2%
mul-1-neg80.2%
unsub-neg80.2%
Simplified80.2%
if 2.39999999999999994e-18 < y Initial program 78.2%
Taylor expanded in y around inf 77.7%
associate-/l*99.4%
div-sub99.4%
*-inverses99.4%
Simplified99.4%
Final simplification91.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.1e-16) (not (<= y 1.6e-23))) (* z (/ y z)) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4.1e-16) || !(y <= 1.6e-23)) {
tmp = z * (y / z);
} else {
tmp = 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 <= (-4.1d-16)) .or. (.not. (y <= 1.6d-23))) then
tmp = z * (y / z)
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -4.1e-16) || !(y <= 1.6e-23)) {
tmp = z * (y / z);
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4.1e-16) or not (y <= 1.6e-23): tmp = z * (y / z) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4.1e-16) || !(y <= 1.6e-23)) tmp = Float64(z * Float64(y / z)); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -4.1e-16) || ~((y <= 1.6e-23))) tmp = z * (y / z); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.1e-16], N[Not[LessEqual[y, 1.6e-23]], $MachinePrecision]], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.1 \cdot 10^{-16} \lor \neg \left(y \leq 1.6 \cdot 10^{-23}\right):\\
\;\;\;\;z \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -4.10000000000000006e-16 or 1.59999999999999988e-23 < y Initial program 77.9%
Taylor expanded in x around 0 38.7%
*-commutative38.7%
associate-/l*53.5%
Applied egg-rr53.5%
if -4.10000000000000006e-16 < y < 1.59999999999999988e-23Initial program 100.0%
Taylor expanded in y around 0 79.6%
Final simplification64.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.7e-13) (not (<= y 1.08e-14))) (/ z (/ z y)) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.7e-13) || !(y <= 1.08e-14)) {
tmp = z / (z / y);
} else {
tmp = 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.7d-13)) .or. (.not. (y <= 1.08d-14))) then
tmp = z / (z / y)
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.7e-13) || !(y <= 1.08e-14)) {
tmp = z / (z / y);
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.7e-13) or not (y <= 1.08e-14): tmp = z / (z / y) else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.7e-13) || !(y <= 1.08e-14)) tmp = Float64(z / Float64(z / y)); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.7e-13) || ~((y <= 1.08e-14))) tmp = z / (z / y); else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.7e-13], N[Not[LessEqual[y, 1.08e-14]], $MachinePrecision]], N[(z / N[(z / y), $MachinePrecision]), $MachinePrecision], N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{-13} \lor \neg \left(y \leq 1.08 \cdot 10^{-14}\right):\\
\;\;\;\;\frac{z}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if y < -1.70000000000000008e-13 or 1.08000000000000004e-14 < y Initial program 77.9%
Taylor expanded in x around 0 38.7%
*-commutative38.7%
associate-/l*53.5%
Applied egg-rr53.5%
clear-num53.4%
un-div-inv53.6%
Applied egg-rr53.6%
if -1.70000000000000008e-13 < y < 1.08000000000000004e-14Initial program 100.0%
Taylor expanded in y around 0 79.6%
Final simplification64.3%
(FPCore (x y z) :precision binary64 (if (<= y -2.7e-16) y (if (<= y 5.8e-18) (/ x z) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.7e-16) {
tmp = y;
} else if (y <= 5.8e-18) {
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 (y <= (-2.7d-16)) then
tmp = y
else if (y <= 5.8d-18) 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 (y <= -2.7e-16) {
tmp = y;
} else if (y <= 5.8e-18) {
tmp = x / z;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.7e-16: tmp = y elif y <= 5.8e-18: tmp = x / z else: tmp = y return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.7e-16) tmp = y; elseif (y <= 5.8e-18) tmp = Float64(x / z); else tmp = y; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.7e-16) tmp = y; elseif (y <= 5.8e-18) tmp = x / z; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.7e-16], y, If[LessEqual[y, 5.8e-18], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{-16}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{-18}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -2.69999999999999999e-16 or 5.8e-18 < y Initial program 77.9%
Taylor expanded in x around 0 53.4%
if -2.69999999999999999e-16 < y < 5.8e-18Initial program 100.0%
Taylor expanded in y around 0 79.6%
Final simplification64.3%
(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 87.1%
Taylor expanded in x around 0 41.0%
Final simplification41.0%
(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 2024073
(FPCore (x y z)
:name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
:precision binary64
:alt
(- (+ y (/ x z)) (/ y (/ z x)))
(/ (+ x (* y (- z x))) z))