
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + ((4.0d0 * ((x + (y * 0.75d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))
double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 + ((4.0d0 * ((x + (y * 0.75d0)) - z)) / y)
end function
public static double code(double x, double y, double z) {
return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y);
}
def code(x, y, z): return 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y)
function code(x, y, z) return Float64(1.0 + Float64(Float64(4.0 * Float64(Float64(x + Float64(y * 0.75)) - z)) / y)) end
function tmp = code(x, y, z) tmp = 1.0 + ((4.0 * ((x + (y * 0.75)) - z)) / y); end
code[x_, y_, z_] := N[(1.0 + N[(N[(4.0 * N[(N[(x + N[(y * 0.75), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + y \cdot 0.75\right) - z\right)}{y}
\end{array}
(FPCore (x y z) :precision binary64 (/ (* 4.0 (+ y (- x z))) y))
double code(double x, double y, double z) {
return (4.0 * (y + (x - z))) / y;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (4.0d0 * (y + (x - z))) / y
end function
public static double code(double x, double y, double z) {
return (4.0 * (y + (x - z))) / y;
}
def code(x, y, z): return (4.0 * (y + (x - z))) / y
function code(x, y, z) return Float64(Float64(4.0 * Float64(y + Float64(x - z))) / y) end
function tmp = code(x, y, z) tmp = (4.0 * (y + (x - z))) / y; end
code[x_, y_, z_] := N[(N[(4.0 * N[(y + N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{4 \cdot \left(y + \left(x - z\right)\right)}{y}
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 100.0%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -4.0 (/ z y))) (t_1 (+ 1.0 (* 4.0 (/ x y)))))
(if (<= x -6.2e+74)
t_1
(if (<= x -4e-185)
t_0
(if (<= x -6.2e-249)
4.0
(if (<= x 1.56e-285)
t_0
(if (<= x 6.4e-252)
4.0
(if (<= x 3.9e-29) t_0 (if (<= x 1.1e+99) 4.0 t_1)))))))))
double code(double x, double y, double z) {
double t_0 = -4.0 * (z / y);
double t_1 = 1.0 + (4.0 * (x / y));
double tmp;
if (x <= -6.2e+74) {
tmp = t_1;
} else if (x <= -4e-185) {
tmp = t_0;
} else if (x <= -6.2e-249) {
tmp = 4.0;
} else if (x <= 1.56e-285) {
tmp = t_0;
} else if (x <= 6.4e-252) {
tmp = 4.0;
} else if (x <= 3.9e-29) {
tmp = t_0;
} else if (x <= 1.1e+99) {
tmp = 4.0;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = (-4.0d0) * (z / y)
t_1 = 1.0d0 + (4.0d0 * (x / y))
if (x <= (-6.2d+74)) then
tmp = t_1
else if (x <= (-4d-185)) then
tmp = t_0
else if (x <= (-6.2d-249)) then
tmp = 4.0d0
else if (x <= 1.56d-285) then
tmp = t_0
else if (x <= 6.4d-252) then
tmp = 4.0d0
else if (x <= 3.9d-29) then
tmp = t_0
else if (x <= 1.1d+99) then
tmp = 4.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -4.0 * (z / y);
double t_1 = 1.0 + (4.0 * (x / y));
double tmp;
if (x <= -6.2e+74) {
tmp = t_1;
} else if (x <= -4e-185) {
tmp = t_0;
} else if (x <= -6.2e-249) {
tmp = 4.0;
} else if (x <= 1.56e-285) {
tmp = t_0;
} else if (x <= 6.4e-252) {
tmp = 4.0;
} else if (x <= 3.9e-29) {
tmp = t_0;
} else if (x <= 1.1e+99) {
tmp = 4.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = -4.0 * (z / y) t_1 = 1.0 + (4.0 * (x / y)) tmp = 0 if x <= -6.2e+74: tmp = t_1 elif x <= -4e-185: tmp = t_0 elif x <= -6.2e-249: tmp = 4.0 elif x <= 1.56e-285: tmp = t_0 elif x <= 6.4e-252: tmp = 4.0 elif x <= 3.9e-29: tmp = t_0 elif x <= 1.1e+99: tmp = 4.0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(-4.0 * Float64(z / y)) t_1 = Float64(1.0 + Float64(4.0 * Float64(x / y))) tmp = 0.0 if (x <= -6.2e+74) tmp = t_1; elseif (x <= -4e-185) tmp = t_0; elseif (x <= -6.2e-249) tmp = 4.0; elseif (x <= 1.56e-285) tmp = t_0; elseif (x <= 6.4e-252) tmp = 4.0; elseif (x <= 3.9e-29) tmp = t_0; elseif (x <= 1.1e+99) tmp = 4.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -4.0 * (z / y); t_1 = 1.0 + (4.0 * (x / y)); tmp = 0.0; if (x <= -6.2e+74) tmp = t_1; elseif (x <= -4e-185) tmp = t_0; elseif (x <= -6.2e-249) tmp = 4.0; elseif (x <= 1.56e-285) tmp = t_0; elseif (x <= 6.4e-252) tmp = 4.0; elseif (x <= 3.9e-29) tmp = t_0; elseif (x <= 1.1e+99) tmp = 4.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.2e+74], t$95$1, If[LessEqual[x, -4e-185], t$95$0, If[LessEqual[x, -6.2e-249], 4.0, If[LessEqual[x, 1.56e-285], t$95$0, If[LessEqual[x, 6.4e-252], 4.0, If[LessEqual[x, 3.9e-29], t$95$0, If[LessEqual[x, 1.1e+99], 4.0, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -4 \cdot \frac{z}{y}\\
t_1 := 1 + 4 \cdot \frac{x}{y}\\
\mathbf{if}\;x \leq -6.2 \cdot 10^{+74}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -4 \cdot 10^{-185}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -6.2 \cdot 10^{-249}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 1.56 \cdot 10^{-285}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 6.4 \cdot 10^{-252}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{-29}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+99}:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -6.20000000000000043e74 or 1.09999999999999989e99 < x Initial program 99.9%
Taylor expanded in x around inf 76.4%
*-commutative76.4%
Simplified76.4%
if -6.20000000000000043e74 < x < -4e-185 or -6.19999999999999971e-249 < x < 1.55999999999999998e-285 or 6.4000000000000004e-252 < x < 3.8999999999999998e-29Initial program 100.0%
Taylor expanded in y around 0 100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in z around inf 58.9%
*-commutative58.9%
Simplified58.9%
if -4e-185 < x < -6.19999999999999971e-249 or 1.55999999999999998e-285 < x < 6.4000000000000004e-252 or 3.8999999999999998e-29 < x < 1.09999999999999989e99Initial program 99.8%
Taylor expanded in y around inf 66.9%
Final simplification67.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* 4.0 x) y)) (t_1 (* -4.0 (/ z y))))
(if (<= x -1.18e+75)
t_0
(if (<= x -1.35e-184)
t_1
(if (<= x -4.5e-239)
4.0
(if (<= x 3.5e-284)
t_1
(if (<= x 7.4e-252)
4.0
(if (<= x 4.3e-32) t_1 (if (<= x 1.15e+99) 4.0 t_0)))))))))
double code(double x, double y, double z) {
double t_0 = (4.0 * x) / y;
double t_1 = -4.0 * (z / y);
double tmp;
if (x <= -1.18e+75) {
tmp = t_0;
} else if (x <= -1.35e-184) {
tmp = t_1;
} else if (x <= -4.5e-239) {
tmp = 4.0;
} else if (x <= 3.5e-284) {
tmp = t_1;
} else if (x <= 7.4e-252) {
tmp = 4.0;
} else if (x <= 4.3e-32) {
tmp = t_1;
} else if (x <= 1.15e+99) {
tmp = 4.0;
} 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) :: t_1
real(8) :: tmp
t_0 = (4.0d0 * x) / y
t_1 = (-4.0d0) * (z / y)
if (x <= (-1.18d+75)) then
tmp = t_0
else if (x <= (-1.35d-184)) then
tmp = t_1
else if (x <= (-4.5d-239)) then
tmp = 4.0d0
else if (x <= 3.5d-284) then
tmp = t_1
else if (x <= 7.4d-252) then
tmp = 4.0d0
else if (x <= 4.3d-32) then
tmp = t_1
else if (x <= 1.15d+99) then
tmp = 4.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (4.0 * x) / y;
double t_1 = -4.0 * (z / y);
double tmp;
if (x <= -1.18e+75) {
tmp = t_0;
} else if (x <= -1.35e-184) {
tmp = t_1;
} else if (x <= -4.5e-239) {
tmp = 4.0;
} else if (x <= 3.5e-284) {
tmp = t_1;
} else if (x <= 7.4e-252) {
tmp = 4.0;
} else if (x <= 4.3e-32) {
tmp = t_1;
} else if (x <= 1.15e+99) {
tmp = 4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (4.0 * x) / y t_1 = -4.0 * (z / y) tmp = 0 if x <= -1.18e+75: tmp = t_0 elif x <= -1.35e-184: tmp = t_1 elif x <= -4.5e-239: tmp = 4.0 elif x <= 3.5e-284: tmp = t_1 elif x <= 7.4e-252: tmp = 4.0 elif x <= 4.3e-32: tmp = t_1 elif x <= 1.15e+99: tmp = 4.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(4.0 * x) / y) t_1 = Float64(-4.0 * Float64(z / y)) tmp = 0.0 if (x <= -1.18e+75) tmp = t_0; elseif (x <= -1.35e-184) tmp = t_1; elseif (x <= -4.5e-239) tmp = 4.0; elseif (x <= 3.5e-284) tmp = t_1; elseif (x <= 7.4e-252) tmp = 4.0; elseif (x <= 4.3e-32) tmp = t_1; elseif (x <= 1.15e+99) tmp = 4.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (4.0 * x) / y; t_1 = -4.0 * (z / y); tmp = 0.0; if (x <= -1.18e+75) tmp = t_0; elseif (x <= -1.35e-184) tmp = t_1; elseif (x <= -4.5e-239) tmp = 4.0; elseif (x <= 3.5e-284) tmp = t_1; elseif (x <= 7.4e-252) tmp = 4.0; elseif (x <= 4.3e-32) tmp = t_1; elseif (x <= 1.15e+99) tmp = 4.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.18e+75], t$95$0, If[LessEqual[x, -1.35e-184], t$95$1, If[LessEqual[x, -4.5e-239], 4.0, If[LessEqual[x, 3.5e-284], t$95$1, If[LessEqual[x, 7.4e-252], 4.0, If[LessEqual[x, 4.3e-32], t$95$1, If[LessEqual[x, 1.15e+99], 4.0, t$95$0]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{4 \cdot x}{y}\\
t_1 := -4 \cdot \frac{z}{y}\\
\mathbf{if}\;x \leq -1.18 \cdot 10^{+75}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1.35 \cdot 10^{-184}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -4.5 \cdot 10^{-239}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-284}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 7.4 \cdot 10^{-252}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 4.3 \cdot 10^{-32}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+99}:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.18e75 or 1.1500000000000001e99 < x Initial program 99.9%
Taylor expanded in y around 0 100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in x around inf 74.3%
if -1.18e75 < x < -1.35e-184 or -4.50000000000000013e-239 < x < 3.49999999999999975e-284 or 7.4000000000000002e-252 < x < 4.2999999999999999e-32Initial program 100.0%
Taylor expanded in y around 0 100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in z around inf 58.9%
*-commutative58.9%
Simplified58.9%
if -1.35e-184 < x < -4.50000000000000013e-239 or 3.49999999999999975e-284 < x < 7.4000000000000002e-252 or 4.2999999999999999e-32 < x < 1.1500000000000001e99Initial program 99.8%
Taylor expanded in y around inf 66.9%
Final simplification66.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.4e+134) (not (<= z 5e+126))) (* -4.0 (/ z y)) (+ 4.0 (* x (/ 4.0 y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.4e+134) || !(z <= 5e+126)) {
tmp = -4.0 * (z / y);
} else {
tmp = 4.0 + (x * (4.0 / 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 <= (-5.4d+134)) .or. (.not. (z <= 5d+126))) then
tmp = (-4.0d0) * (z / y)
else
tmp = 4.0d0 + (x * (4.0d0 / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -5.4e+134) || !(z <= 5e+126)) {
tmp = -4.0 * (z / y);
} else {
tmp = 4.0 + (x * (4.0 / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.4e+134) or not (z <= 5e+126): tmp = -4.0 * (z / y) else: tmp = 4.0 + (x * (4.0 / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.4e+134) || !(z <= 5e+126)) tmp = Float64(-4.0 * Float64(z / y)); else tmp = Float64(4.0 + Float64(x * Float64(4.0 / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5.4e+134) || ~((z <= 5e+126))) tmp = -4.0 * (z / y); else tmp = 4.0 + (x * (4.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.4e+134], N[Not[LessEqual[z, 5e+126]], $MachinePrecision]], N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision], N[(4.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{+134} \lor \neg \left(z \leq 5 \cdot 10^{+126}\right):\\
\;\;\;\;-4 \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + x \cdot \frac{4}{y}\\
\end{array}
\end{array}
if z < -5.4e134 or 4.99999999999999977e126 < z Initial program 99.9%
Taylor expanded in y around 0 100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in z around inf 81.5%
*-commutative81.5%
Simplified81.5%
if -5.4e134 < z < 4.99999999999999977e126Initial program 99.9%
+-commutative99.9%
associate-/l*99.9%
fma-define99.9%
associate--l+99.9%
+-commutative99.9%
remove-double-neg99.9%
sub-neg99.9%
associate--r+99.9%
div-sub99.9%
sub-neg99.9%
associate-*l/100.0%
*-inverses100.0%
metadata-eval100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
distribute-neg-out100.0%
+-commutative100.0%
sub-neg100.0%
distribute-frac-neg100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in z around 0 87.0%
distribute-lft-in87.0%
metadata-eval87.0%
associate-+r+87.0%
metadata-eval87.0%
*-commutative87.0%
associate-*l/87.0%
associate-*r/86.9%
Simplified86.9%
Final simplification85.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -5.2e+76) (not (<= x 5.6e-83))) (+ 4.0 (* x (/ 4.0 y))) (+ 4.0 (/ (* z -4.0) y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -5.2e+76) || !(x <= 5.6e-83)) {
tmp = 4.0 + (x * (4.0 / y));
} else {
tmp = 4.0 + ((z * -4.0) / 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 ((x <= (-5.2d+76)) .or. (.not. (x <= 5.6d-83))) then
tmp = 4.0d0 + (x * (4.0d0 / y))
else
tmp = 4.0d0 + ((z * (-4.0d0)) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -5.2e+76) || !(x <= 5.6e-83)) {
tmp = 4.0 + (x * (4.0 / y));
} else {
tmp = 4.0 + ((z * -4.0) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -5.2e+76) or not (x <= 5.6e-83): tmp = 4.0 + (x * (4.0 / y)) else: tmp = 4.0 + ((z * -4.0) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -5.2e+76) || !(x <= 5.6e-83)) tmp = Float64(4.0 + Float64(x * Float64(4.0 / y))); else tmp = Float64(4.0 + Float64(Float64(z * -4.0) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -5.2e+76) || ~((x <= 5.6e-83))) tmp = 4.0 + (x * (4.0 / y)); else tmp = 4.0 + ((z * -4.0) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -5.2e+76], N[Not[LessEqual[x, 5.6e-83]], $MachinePrecision]], N[(4.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(4.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{+76} \lor \neg \left(x \leq 5.6 \cdot 10^{-83}\right):\\
\;\;\;\;4 + x \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + \frac{z \cdot -4}{y}\\
\end{array}
\end{array}
if x < -5.1999999999999999e76 or 5.6000000000000002e-83 < x Initial program 99.9%
+-commutative99.9%
associate-/l*99.9%
fma-define99.9%
associate--l+99.9%
+-commutative99.9%
remove-double-neg99.9%
sub-neg99.9%
associate--r+99.9%
div-sub99.9%
sub-neg99.9%
associate-*l/100.0%
*-inverses100.0%
metadata-eval100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
distribute-neg-out100.0%
+-commutative100.0%
sub-neg100.0%
distribute-frac-neg100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in z around 0 87.8%
distribute-lft-in87.8%
metadata-eval87.8%
associate-+r+87.8%
metadata-eval87.8%
*-commutative87.8%
associate-*l/87.8%
associate-*r/87.6%
Simplified87.6%
if -5.1999999999999999e76 < x < 5.6000000000000002e-83Initial program 99.9%
Taylor expanded in x around 0 92.0%
+-commutative92.0%
fma-define92.0%
div-sub92.0%
associate-/l*92.1%
*-inverses92.1%
metadata-eval92.1%
fma-define92.1%
+-commutative92.1%
sub-neg92.1%
distribute-lft-in92.1%
metadata-eval92.1%
associate-+r+92.1%
metadata-eval92.1%
neg-mul-192.1%
associate-*r*92.1%
metadata-eval92.1%
*-commutative92.1%
associate-*l/92.1%
Simplified92.1%
Final simplification89.7%
(FPCore (x y z) :precision binary64 (if (<= z -1.9e+129) (+ 4.0 (/ (* z -4.0) y)) (if (<= z 2.7e+23) (+ 4.0 (* x (/ 4.0 y))) (/ 4.0 (/ y (- x z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.9e+129) {
tmp = 4.0 + ((z * -4.0) / y);
} else if (z <= 2.7e+23) {
tmp = 4.0 + (x * (4.0 / y));
} else {
tmp = 4.0 / (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 (z <= (-1.9d+129)) then
tmp = 4.0d0 + ((z * (-4.0d0)) / y)
else if (z <= 2.7d+23) then
tmp = 4.0d0 + (x * (4.0d0 / y))
else
tmp = 4.0d0 / (y / (x - z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.9e+129) {
tmp = 4.0 + ((z * -4.0) / y);
} else if (z <= 2.7e+23) {
tmp = 4.0 + (x * (4.0 / y));
} else {
tmp = 4.0 / (y / (x - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.9e+129: tmp = 4.0 + ((z * -4.0) / y) elif z <= 2.7e+23: tmp = 4.0 + (x * (4.0 / y)) else: tmp = 4.0 / (y / (x - z)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.9e+129) tmp = Float64(4.0 + Float64(Float64(z * -4.0) / y)); elseif (z <= 2.7e+23) tmp = Float64(4.0 + Float64(x * Float64(4.0 / y))); else tmp = Float64(4.0 / Float64(y / Float64(x - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.9e+129) tmp = 4.0 + ((z * -4.0) / y); elseif (z <= 2.7e+23) tmp = 4.0 + (x * (4.0 / y)); else tmp = 4.0 / (y / (x - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.9e+129], N[(4.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.7e+23], N[(4.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(4.0 / N[(y / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+129}:\\
\;\;\;\;4 + \frac{z \cdot -4}{y}\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+23}:\\
\;\;\;\;4 + x \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{4}{\frac{y}{x - z}}\\
\end{array}
\end{array}
if z < -1.90000000000000003e129Initial program 100.0%
Taylor expanded in x around 0 93.8%
+-commutative93.8%
fma-define93.8%
div-sub93.8%
associate-/l*93.8%
*-inverses93.8%
metadata-eval93.8%
fma-define93.8%
+-commutative93.8%
sub-neg93.8%
distribute-lft-in93.8%
metadata-eval93.8%
associate-+r+93.9%
metadata-eval93.9%
neg-mul-193.9%
associate-*r*93.9%
metadata-eval93.9%
*-commutative93.9%
associate-*l/93.9%
Simplified93.9%
if -1.90000000000000003e129 < z < 2.6999999999999999e23Initial program 99.9%
+-commutative99.9%
associate-/l*99.9%
fma-define99.9%
associate--l+99.9%
+-commutative99.9%
remove-double-neg99.9%
sub-neg99.9%
associate--r+99.9%
div-sub99.9%
sub-neg99.9%
associate-*l/100.0%
*-inverses100.0%
metadata-eval100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
distribute-neg-out100.0%
+-commutative100.0%
sub-neg100.0%
distribute-frac-neg100.0%
distribute-frac-neg2100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in z around 0 90.5%
distribute-lft-in90.5%
metadata-eval90.5%
associate-+r+90.5%
metadata-eval90.5%
*-commutative90.5%
associate-*l/90.5%
associate-*r/90.3%
Simplified90.3%
if 2.6999999999999999e23 < z Initial program 99.9%
Taylor expanded in y around 0 100.0%
distribute-lft-out100.0%
Simplified100.0%
clear-num99.8%
inv-pow99.8%
*-un-lft-identity99.8%
times-frac99.8%
metadata-eval99.8%
Applied egg-rr99.8%
unpow-199.8%
associate-/r*99.8%
metadata-eval99.8%
associate-+r-99.8%
+-commutative99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in y around 0 88.7%
Final simplification90.5%
(FPCore (x y z) :precision binary64 (if (<= z -1.22e+129) (+ 4.0 (/ (* z -4.0) y)) (if (<= z 9.6e+22) (/ (* 4.0 (+ y x)) y) (/ 4.0 (/ y (- x z))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.22e+129) {
tmp = 4.0 + ((z * -4.0) / y);
} else if (z <= 9.6e+22) {
tmp = (4.0 * (y + x)) / y;
} else {
tmp = 4.0 / (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 (z <= (-1.22d+129)) then
tmp = 4.0d0 + ((z * (-4.0d0)) / y)
else if (z <= 9.6d+22) then
tmp = (4.0d0 * (y + x)) / y
else
tmp = 4.0d0 / (y / (x - z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.22e+129) {
tmp = 4.0 + ((z * -4.0) / y);
} else if (z <= 9.6e+22) {
tmp = (4.0 * (y + x)) / y;
} else {
tmp = 4.0 / (y / (x - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.22e+129: tmp = 4.0 + ((z * -4.0) / y) elif z <= 9.6e+22: tmp = (4.0 * (y + x)) / y else: tmp = 4.0 / (y / (x - z)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.22e+129) tmp = Float64(4.0 + Float64(Float64(z * -4.0) / y)); elseif (z <= 9.6e+22) tmp = Float64(Float64(4.0 * Float64(y + x)) / y); else tmp = Float64(4.0 / Float64(y / Float64(x - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.22e+129) tmp = 4.0 + ((z * -4.0) / y); elseif (z <= 9.6e+22) tmp = (4.0 * (y + x)) / y; else tmp = 4.0 / (y / (x - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.22e+129], N[(4.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.6e+22], N[(N[(4.0 * N[(y + x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(4.0 / N[(y / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.22 \cdot 10^{+129}:\\
\;\;\;\;4 + \frac{z \cdot -4}{y}\\
\mathbf{elif}\;z \leq 9.6 \cdot 10^{+22}:\\
\;\;\;\;\frac{4 \cdot \left(y + x\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{4}{\frac{y}{x - z}}\\
\end{array}
\end{array}
if z < -1.2200000000000001e129Initial program 100.0%
Taylor expanded in x around 0 93.8%
+-commutative93.8%
fma-define93.8%
div-sub93.8%
associate-/l*93.8%
*-inverses93.8%
metadata-eval93.8%
fma-define93.8%
+-commutative93.8%
sub-neg93.8%
distribute-lft-in93.8%
metadata-eval93.8%
associate-+r+93.9%
metadata-eval93.9%
neg-mul-193.9%
associate-*r*93.9%
metadata-eval93.9%
*-commutative93.9%
associate-*l/93.9%
Simplified93.9%
if -1.2200000000000001e129 < z < 9.6e22Initial program 99.9%
Taylor expanded in y around 0 100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in z around 0 90.5%
if 9.6e22 < z Initial program 99.9%
Taylor expanded in y around 0 100.0%
distribute-lft-out100.0%
Simplified100.0%
clear-num99.8%
inv-pow99.8%
*-un-lft-identity99.8%
times-frac99.8%
metadata-eval99.8%
Applied egg-rr99.8%
unpow-199.8%
associate-/r*99.8%
metadata-eval99.8%
associate-+r-99.8%
+-commutative99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in y around 0 88.7%
Final simplification90.6%
(FPCore (x y z) :precision binary64 (if (<= z -1.85e+129) (+ 4.0 (/ (* z -4.0) y)) (if (<= z 2.7e+22) (/ (* 4.0 (+ y x)) y) (/ (* 4.0 (- x z)) y))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.85e+129) {
tmp = 4.0 + ((z * -4.0) / y);
} else if (z <= 2.7e+22) {
tmp = (4.0 * (y + x)) / y;
} else {
tmp = (4.0 * (x - z)) / 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 <= (-1.85d+129)) then
tmp = 4.0d0 + ((z * (-4.0d0)) / y)
else if (z <= 2.7d+22) then
tmp = (4.0d0 * (y + x)) / y
else
tmp = (4.0d0 * (x - z)) / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.85e+129) {
tmp = 4.0 + ((z * -4.0) / y);
} else if (z <= 2.7e+22) {
tmp = (4.0 * (y + x)) / y;
} else {
tmp = (4.0 * (x - z)) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.85e+129: tmp = 4.0 + ((z * -4.0) / y) elif z <= 2.7e+22: tmp = (4.0 * (y + x)) / y else: tmp = (4.0 * (x - z)) / y return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.85e+129) tmp = Float64(4.0 + Float64(Float64(z * -4.0) / y)); elseif (z <= 2.7e+22) tmp = Float64(Float64(4.0 * Float64(y + x)) / y); else tmp = Float64(Float64(4.0 * Float64(x - z)) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.85e+129) tmp = 4.0 + ((z * -4.0) / y); elseif (z <= 2.7e+22) tmp = (4.0 * (y + x)) / y; else tmp = (4.0 * (x - z)) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.85e+129], N[(4.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.7e+22], N[(N[(4.0 * N[(y + x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(4.0 * N[(x - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+129}:\\
\;\;\;\;4 + \frac{z \cdot -4}{y}\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+22}:\\
\;\;\;\;\frac{4 \cdot \left(y + x\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{4 \cdot \left(x - z\right)}{y}\\
\end{array}
\end{array}
if z < -1.84999999999999989e129Initial program 100.0%
Taylor expanded in x around 0 93.8%
+-commutative93.8%
fma-define93.8%
div-sub93.8%
associate-/l*93.8%
*-inverses93.8%
metadata-eval93.8%
fma-define93.8%
+-commutative93.8%
sub-neg93.8%
distribute-lft-in93.8%
metadata-eval93.8%
associate-+r+93.9%
metadata-eval93.9%
neg-mul-193.9%
associate-*r*93.9%
metadata-eval93.9%
*-commutative93.9%
associate-*l/93.9%
Simplified93.9%
if -1.84999999999999989e129 < z < 2.7000000000000002e22Initial program 99.9%
Taylor expanded in y around 0 100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in z around 0 90.5%
if 2.7000000000000002e22 < z Initial program 99.9%
Taylor expanded in y around 0 100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in y around 0 88.8%
Final simplification90.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -5.8e+133) (not (<= z 1.2e+23))) (* -4.0 (/ z y)) 4.0))
double code(double x, double y, double z) {
double tmp;
if ((z <= -5.8e+133) || !(z <= 1.2e+23)) {
tmp = -4.0 * (z / y);
} else {
tmp = 4.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) :: tmp
if ((z <= (-5.8d+133)) .or. (.not. (z <= 1.2d+23))) then
tmp = (-4.0d0) * (z / y)
else
tmp = 4.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -5.8e+133) || !(z <= 1.2e+23)) {
tmp = -4.0 * (z / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -5.8e+133) or not (z <= 1.2e+23): tmp = -4.0 * (z / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -5.8e+133) || !(z <= 1.2e+23)) tmp = Float64(-4.0 * Float64(z / y)); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -5.8e+133) || ~((z <= 1.2e+23))) tmp = -4.0 * (z / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -5.8e+133], N[Not[LessEqual[z, 1.2e+23]], $MachinePrecision]], N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision], 4.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+133} \lor \neg \left(z \leq 1.2 \cdot 10^{+23}\right):\\
\;\;\;\;-4 \cdot \frac{z}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if z < -5.8000000000000002e133 or 1.2e23 < z Initial program 99.9%
Taylor expanded in y around 0 100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in z around inf 70.3%
*-commutative70.3%
Simplified70.3%
if -5.8000000000000002e133 < z < 1.2e23Initial program 99.9%
Taylor expanded in y around inf 43.6%
Final simplification53.8%
(FPCore (x y z) :precision binary64 (/ 4.0 (/ y (+ x (- y z)))))
double code(double x, double y, double z) {
return 4.0 / (y / (x + (y - z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 4.0d0 / (y / (x + (y - z)))
end function
public static double code(double x, double y, double z) {
return 4.0 / (y / (x + (y - z)));
}
def code(x, y, z): return 4.0 / (y / (x + (y - z)))
function code(x, y, z) return Float64(4.0 / Float64(y / Float64(x + Float64(y - z)))) end
function tmp = code(x, y, z) tmp = 4.0 / (y / (x + (y - z))); end
code[x_, y_, z_] := N[(4.0 / N[(y / N[(x + N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{4}{\frac{y}{x + \left(y - z\right)}}
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 100.0%
distribute-lft-out100.0%
Simplified100.0%
clear-num99.8%
inv-pow99.8%
*-un-lft-identity99.8%
times-frac99.8%
metadata-eval99.8%
Applied egg-rr99.8%
unpow-199.8%
associate-/r*99.8%
metadata-eval99.8%
associate-+r-99.8%
+-commutative99.8%
associate--l+99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.9%
Taylor expanded in x around inf 42.6%
*-commutative42.6%
Simplified42.6%
Taylor expanded in x around 0 7.1%
Final simplification7.1%
(FPCore (x y z) :precision binary64 4.0)
double code(double x, double y, double z) {
return 4.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 4.0d0
end function
public static double code(double x, double y, double z) {
return 4.0;
}
def code(x, y, z): return 4.0
function code(x, y, z) return 4.0 end
function tmp = code(x, y, z) tmp = 4.0; end
code[x_, y_, z_] := 4.0
\begin{array}{l}
\\
4
\end{array}
Initial program 99.9%
Taylor expanded in y around inf 31.7%
Final simplification31.7%
herbie shell --seed 2024055
(FPCore (x y z)
:name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, A"
:precision binary64
(+ 1.0 (/ (* 4.0 (- (+ x (* y 0.75)) z)) y)))