
(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 10 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 (+ 1.0 (* 4.0 (+ 0.75 (/ (- x z) y)))))
double code(double x, double y, double z) {
return 1.0 + (4.0 * (0.75 + ((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 = 1.0d0 + (4.0d0 * (0.75d0 + ((x - z) / y)))
end function
public static double code(double x, double y, double z) {
return 1.0 + (4.0 * (0.75 + ((x - z) / y)));
}
def code(x, y, z): return 1.0 + (4.0 * (0.75 + ((x - z) / y)))
function code(x, y, z) return Float64(1.0 + Float64(4.0 * Float64(0.75 + Float64(Float64(x - z) / y)))) end
function tmp = code(x, y, z) tmp = 1.0 + (4.0 * (0.75 + ((x - z) / y))); end
code[x_, y_, z_] := N[(1.0 + N[(4.0 * N[(0.75 + N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + 4 \cdot \left(0.75 + \frac{x - z}{y}\right)
\end{array}
Initial program 99.6%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 98.8%
associate--l+98.8%
div-sub100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ z y) -4.0)) (t_1 (* x (/ 4.0 y))))
(if (<= y -0.027)
4.0
(if (<= y -1.45e-53)
t_1
(if (<= y -3.9e-81)
t_0
(if (<= y -5.5e-198)
t_1
(if (<= y -7.2e-299)
t_0
(if (<= y 6.1e-284) t_1 (if (<= y 7.2e+102) t_0 4.0)))))))))
double code(double x, double y, double z) {
double t_0 = (z / y) * -4.0;
double t_1 = x * (4.0 / y);
double tmp;
if (y <= -0.027) {
tmp = 4.0;
} else if (y <= -1.45e-53) {
tmp = t_1;
} else if (y <= -3.9e-81) {
tmp = t_0;
} else if (y <= -5.5e-198) {
tmp = t_1;
} else if (y <= -7.2e-299) {
tmp = t_0;
} else if (y <= 6.1e-284) {
tmp = t_1;
} else if (y <= 7.2e+102) {
tmp = t_0;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (z / y) * (-4.0d0)
t_1 = x * (4.0d0 / y)
if (y <= (-0.027d0)) then
tmp = 4.0d0
else if (y <= (-1.45d-53)) then
tmp = t_1
else if (y <= (-3.9d-81)) then
tmp = t_0
else if (y <= (-5.5d-198)) then
tmp = t_1
else if (y <= (-7.2d-299)) then
tmp = t_0
else if (y <= 6.1d-284) then
tmp = t_1
else if (y <= 7.2d+102) then
tmp = t_0
else
tmp = 4.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (z / y) * -4.0;
double t_1 = x * (4.0 / y);
double tmp;
if (y <= -0.027) {
tmp = 4.0;
} else if (y <= -1.45e-53) {
tmp = t_1;
} else if (y <= -3.9e-81) {
tmp = t_0;
} else if (y <= -5.5e-198) {
tmp = t_1;
} else if (y <= -7.2e-299) {
tmp = t_0;
} else if (y <= 6.1e-284) {
tmp = t_1;
} else if (y <= 7.2e+102) {
tmp = t_0;
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): t_0 = (z / y) * -4.0 t_1 = x * (4.0 / y) tmp = 0 if y <= -0.027: tmp = 4.0 elif y <= -1.45e-53: tmp = t_1 elif y <= -3.9e-81: tmp = t_0 elif y <= -5.5e-198: tmp = t_1 elif y <= -7.2e-299: tmp = t_0 elif y <= 6.1e-284: tmp = t_1 elif y <= 7.2e+102: tmp = t_0 else: tmp = 4.0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z / y) * -4.0) t_1 = Float64(x * Float64(4.0 / y)) tmp = 0.0 if (y <= -0.027) tmp = 4.0; elseif (y <= -1.45e-53) tmp = t_1; elseif (y <= -3.9e-81) tmp = t_0; elseif (y <= -5.5e-198) tmp = t_1; elseif (y <= -7.2e-299) tmp = t_0; elseif (y <= 6.1e-284) tmp = t_1; elseif (y <= 7.2e+102) tmp = t_0; else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z / y) * -4.0; t_1 = x * (4.0 / y); tmp = 0.0; if (y <= -0.027) tmp = 4.0; elseif (y <= -1.45e-53) tmp = t_1; elseif (y <= -3.9e-81) tmp = t_0; elseif (y <= -5.5e-198) tmp = t_1; elseif (y <= -7.2e-299) tmp = t_0; elseif (y <= 6.1e-284) tmp = t_1; elseif (y <= 7.2e+102) tmp = t_0; else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.027], 4.0, If[LessEqual[y, -1.45e-53], t$95$1, If[LessEqual[y, -3.9e-81], t$95$0, If[LessEqual[y, -5.5e-198], t$95$1, If[LessEqual[y, -7.2e-299], t$95$0, If[LessEqual[y, 6.1e-284], t$95$1, If[LessEqual[y, 7.2e+102], t$95$0, 4.0]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z}{y} \cdot -4\\
t_1 := x \cdot \frac{4}{y}\\
\mathbf{if}\;y \leq -0.027:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq -1.45 \cdot 10^{-53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -3.9 \cdot 10^{-81}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -5.5 \cdot 10^{-198}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -7.2 \cdot 10^{-299}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 6.1 \cdot 10^{-284}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{+102}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -0.0269999999999999997 or 7.2000000000000003e102 < y Initial program 99.0%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around inf 64.2%
if -0.0269999999999999997 < y < -1.4499999999999999e-53 or -3.89999999999999985e-81 < y < -5.5000000000000001e-198 or -7.2e-299 < y < 6.09999999999999976e-284Initial program 100.0%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around -inf 99.9%
mul-1-neg99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
associate-*r/99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-lft-in99.9%
neg-mul-199.9%
remove-double-neg99.9%
neg-mul-199.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 88.3%
mul-1-neg88.3%
*-commutative88.3%
distribute-rgt-neg-in88.3%
sub-neg88.3%
metadata-eval88.3%
+-commutative88.3%
Simplified88.3%
Taylor expanded in x around inf 66.7%
*-commutative66.7%
associate-*l/66.7%
associate-/l*66.5%
Simplified66.5%
if -1.4499999999999999e-53 < y < -3.89999999999999985e-81 or -5.5000000000000001e-198 < y < -7.2e-299 or 6.09999999999999976e-284 < y < 7.2000000000000003e102Initial program 100.0%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around -inf 93.1%
mul-1-neg93.1%
*-commutative93.1%
distribute-rgt-neg-in93.1%
sub-neg93.1%
metadata-eval93.1%
+-commutative93.1%
associate-*r/93.1%
sub-neg93.1%
+-commutative93.1%
*-commutative93.1%
distribute-lft-in93.1%
neg-mul-193.1%
remove-double-neg93.1%
neg-mul-193.1%
distribute-rgt-neg-in93.1%
metadata-eval93.1%
Simplified93.1%
Taylor expanded in y around 0 88.5%
mul-1-neg88.5%
*-commutative88.5%
distribute-rgt-neg-in88.5%
sub-neg88.5%
metadata-eval88.5%
+-commutative88.5%
Simplified88.5%
Taylor expanded in z around inf 62.5%
*-commutative62.5%
Simplified62.5%
Final simplification64.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ z y) -4.0)) (t_1 (/ (* 4.0 x) y)))
(if (<= y -0.017)
4.0
(if (<= y -1.05e-54)
t_1
(if (<= y -2.2e-81)
t_0
(if (<= y -2.05e-199)
t_1
(if (<= y -1.65e-298)
t_0
(if (<= y 1.36e-283)
(* x (/ 4.0 y))
(if (<= y 1.45e+102) t_0 4.0)))))))))
double code(double x, double y, double z) {
double t_0 = (z / y) * -4.0;
double t_1 = (4.0 * x) / y;
double tmp;
if (y <= -0.017) {
tmp = 4.0;
} else if (y <= -1.05e-54) {
tmp = t_1;
} else if (y <= -2.2e-81) {
tmp = t_0;
} else if (y <= -2.05e-199) {
tmp = t_1;
} else if (y <= -1.65e-298) {
tmp = t_0;
} else if (y <= 1.36e-283) {
tmp = x * (4.0 / y);
} else if (y <= 1.45e+102) {
tmp = t_0;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (z / y) * (-4.0d0)
t_1 = (4.0d0 * x) / y
if (y <= (-0.017d0)) then
tmp = 4.0d0
else if (y <= (-1.05d-54)) then
tmp = t_1
else if (y <= (-2.2d-81)) then
tmp = t_0
else if (y <= (-2.05d-199)) then
tmp = t_1
else if (y <= (-1.65d-298)) then
tmp = t_0
else if (y <= 1.36d-283) then
tmp = x * (4.0d0 / y)
else if (y <= 1.45d+102) then
tmp = t_0
else
tmp = 4.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (z / y) * -4.0;
double t_1 = (4.0 * x) / y;
double tmp;
if (y <= -0.017) {
tmp = 4.0;
} else if (y <= -1.05e-54) {
tmp = t_1;
} else if (y <= -2.2e-81) {
tmp = t_0;
} else if (y <= -2.05e-199) {
tmp = t_1;
} else if (y <= -1.65e-298) {
tmp = t_0;
} else if (y <= 1.36e-283) {
tmp = x * (4.0 / y);
} else if (y <= 1.45e+102) {
tmp = t_0;
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): t_0 = (z / y) * -4.0 t_1 = (4.0 * x) / y tmp = 0 if y <= -0.017: tmp = 4.0 elif y <= -1.05e-54: tmp = t_1 elif y <= -2.2e-81: tmp = t_0 elif y <= -2.05e-199: tmp = t_1 elif y <= -1.65e-298: tmp = t_0 elif y <= 1.36e-283: tmp = x * (4.0 / y) elif y <= 1.45e+102: tmp = t_0 else: tmp = 4.0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z / y) * -4.0) t_1 = Float64(Float64(4.0 * x) / y) tmp = 0.0 if (y <= -0.017) tmp = 4.0; elseif (y <= -1.05e-54) tmp = t_1; elseif (y <= -2.2e-81) tmp = t_0; elseif (y <= -2.05e-199) tmp = t_1; elseif (y <= -1.65e-298) tmp = t_0; elseif (y <= 1.36e-283) tmp = Float64(x * Float64(4.0 / y)); elseif (y <= 1.45e+102) tmp = t_0; else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z / y) * -4.0; t_1 = (4.0 * x) / y; tmp = 0.0; if (y <= -0.017) tmp = 4.0; elseif (y <= -1.05e-54) tmp = t_1; elseif (y <= -2.2e-81) tmp = t_0; elseif (y <= -2.05e-199) tmp = t_1; elseif (y <= -1.65e-298) tmp = t_0; elseif (y <= 1.36e-283) tmp = x * (4.0 / y); elseif (y <= 1.45e+102) tmp = t_0; else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -0.017], 4.0, If[LessEqual[y, -1.05e-54], t$95$1, If[LessEqual[y, -2.2e-81], t$95$0, If[LessEqual[y, -2.05e-199], t$95$1, If[LessEqual[y, -1.65e-298], t$95$0, If[LessEqual[y, 1.36e-283], N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.45e+102], t$95$0, 4.0]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z}{y} \cdot -4\\
t_1 := \frac{4 \cdot x}{y}\\
\mathbf{if}\;y \leq -0.017:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq -1.05 \cdot 10^{-54}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2.2 \cdot 10^{-81}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -2.05 \cdot 10^{-199}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.65 \cdot 10^{-298}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.36 \cdot 10^{-283}:\\
\;\;\;\;x \cdot \frac{4}{y}\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+102}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -0.017000000000000001 or 1.4500000000000001e102 < y Initial program 99.0%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around inf 64.2%
if -0.017000000000000001 < y < -1.05e-54 or -2.1999999999999999e-81 < y < -2.05000000000000011e-199Initial program 100.0%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 86.3%
Taylor expanded in x around inf 63.1%
associate-*r/63.1%
Simplified63.1%
if -1.05e-54 < y < -2.1999999999999999e-81 or -2.05000000000000011e-199 < y < -1.6500000000000001e-298 or 1.35999999999999997e-283 < y < 1.4500000000000001e102Initial program 100.0%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around -inf 93.1%
mul-1-neg93.1%
*-commutative93.1%
distribute-rgt-neg-in93.1%
sub-neg93.1%
metadata-eval93.1%
+-commutative93.1%
associate-*r/93.1%
sub-neg93.1%
+-commutative93.1%
*-commutative93.1%
distribute-lft-in93.1%
neg-mul-193.1%
remove-double-neg93.1%
neg-mul-193.1%
distribute-rgt-neg-in93.1%
metadata-eval93.1%
Simplified93.1%
Taylor expanded in y around 0 88.5%
mul-1-neg88.5%
*-commutative88.5%
distribute-rgt-neg-in88.5%
sub-neg88.5%
metadata-eval88.5%
+-commutative88.5%
Simplified88.5%
Taylor expanded in z around inf 62.5%
*-commutative62.5%
Simplified62.5%
if -1.6500000000000001e-298 < y < 1.35999999999999997e-283Initial program 100.0%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around -inf 100.0%
mul-1-neg100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
associate-*r/100.0%
sub-neg100.0%
+-commutative100.0%
*-commutative100.0%
distribute-lft-in100.0%
neg-mul-1100.0%
remove-double-neg100.0%
neg-mul-1100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
mul-1-neg100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 86.5%
*-commutative86.5%
associate-*l/86.5%
associate-/l*86.5%
Simplified86.5%
Final simplification64.0%
(FPCore (x y z)
:precision binary64
(if (<= y -8.5e+171)
4.0
(if (or (<= y -7.8e+112) (and (not (<= y -1.15e+60)) (<= y 6.2e+130)))
(* 4.0 (/ (- x z) y))
4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -8.5e+171) {
tmp = 4.0;
} else if ((y <= -7.8e+112) || (!(y <= -1.15e+60) && (y <= 6.2e+130))) {
tmp = 4.0 * ((x - 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 (y <= (-8.5d+171)) then
tmp = 4.0d0
else if ((y <= (-7.8d+112)) .or. (.not. (y <= (-1.15d+60))) .and. (y <= 6.2d+130)) then
tmp = 4.0d0 * ((x - 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 (y <= -8.5e+171) {
tmp = 4.0;
} else if ((y <= -7.8e+112) || (!(y <= -1.15e+60) && (y <= 6.2e+130))) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -8.5e+171: tmp = 4.0 elif (y <= -7.8e+112) or (not (y <= -1.15e+60) and (y <= 6.2e+130)): tmp = 4.0 * ((x - z) / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -8.5e+171) tmp = 4.0; elseif ((y <= -7.8e+112) || (!(y <= -1.15e+60) && (y <= 6.2e+130))) tmp = Float64(4.0 * Float64(Float64(x - z) / y)); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -8.5e+171) tmp = 4.0; elseif ((y <= -7.8e+112) || (~((y <= -1.15e+60)) && (y <= 6.2e+130))) tmp = 4.0 * ((x - z) / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -8.5e+171], 4.0, If[Or[LessEqual[y, -7.8e+112], And[N[Not[LessEqual[y, -1.15e+60]], $MachinePrecision], LessEqual[y, 6.2e+130]]], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{+171}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq -7.8 \cdot 10^{+112} \lor \neg \left(y \leq -1.15 \cdot 10^{+60}\right) \land y \leq 6.2 \cdot 10^{+130}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -8.4999999999999995e171 or -7.79999999999999937e112 < y < -1.15000000000000008e60 or 6.1999999999999999e130 < y Initial program 98.6%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around inf 76.6%
if -8.4999999999999995e171 < y < -7.79999999999999937e112 or -1.15000000000000008e60 < y < 6.1999999999999999e130Initial program 100.0%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 86.8%
Taylor expanded in y around 0 84.9%
Final simplification82.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (* 4.0 (+ 0.75 (/ x y))))))
(if (<= x -3e+69)
t_0
(if (<= x 8.6e-66)
(+ 1.0 (* 4.0 (- 0.75 (/ z y))))
(if (<= x 4.2e+39) t_0 (* 4.0 (/ (- x z) y)))))))
double code(double x, double y, double z) {
double t_0 = 1.0 + (4.0 * (0.75 + (x / y)));
double tmp;
if (x <= -3e+69) {
tmp = t_0;
} else if (x <= 8.6e-66) {
tmp = 1.0 + (4.0 * (0.75 - (z / y)));
} else if (x <= 4.2e+39) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (4.0d0 * (0.75d0 + (x / y)))
if (x <= (-3d+69)) then
tmp = t_0
else if (x <= 8.6d-66) then
tmp = 1.0d0 + (4.0d0 * (0.75d0 - (z / y)))
else if (x <= 4.2d+39) then
tmp = t_0
else
tmp = 4.0d0 * ((x - z) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 + (4.0 * (0.75 + (x / y)));
double tmp;
if (x <= -3e+69) {
tmp = t_0;
} else if (x <= 8.6e-66) {
tmp = 1.0 + (4.0 * (0.75 - (z / y)));
} else if (x <= 4.2e+39) {
tmp = t_0;
} else {
tmp = 4.0 * ((x - z) / y);
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + (4.0 * (0.75 + (x / y))) tmp = 0 if x <= -3e+69: tmp = t_0 elif x <= 8.6e-66: tmp = 1.0 + (4.0 * (0.75 - (z / y))) elif x <= 4.2e+39: tmp = t_0 else: tmp = 4.0 * ((x - z) / y) return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(4.0 * Float64(0.75 + Float64(x / y)))) tmp = 0.0 if (x <= -3e+69) tmp = t_0; elseif (x <= 8.6e-66) tmp = Float64(1.0 + Float64(4.0 * Float64(0.75 - Float64(z / y)))); elseif (x <= 4.2e+39) tmp = t_0; else tmp = Float64(4.0 * Float64(Float64(x - z) / y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + (4.0 * (0.75 + (x / y))); tmp = 0.0; if (x <= -3e+69) tmp = t_0; elseif (x <= 8.6e-66) tmp = 1.0 + (4.0 * (0.75 - (z / y))); elseif (x <= 4.2e+39) tmp = t_0; else tmp = 4.0 * ((x - z) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(4.0 * N[(0.75 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3e+69], t$95$0, If[LessEqual[x, 8.6e-66], N[(1.0 + N[(4.0 * N[(0.75 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.2e+39], t$95$0, N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + 4 \cdot \left(0.75 + \frac{x}{y}\right)\\
\mathbf{if}\;x \leq -3 \cdot 10^{+69}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 8.6 \cdot 10^{-66}:\\
\;\;\;\;1 + 4 \cdot \left(0.75 - \frac{z}{y}\right)\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{+39}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\end{array}
\end{array}
if x < -2.99999999999999983e69 or 8.60000000000000027e-66 < x < 4.1999999999999997e39Initial program 100.0%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around 0 97.2%
associate--l+97.2%
div-sub100.0%
Simplified100.0%
Taylor expanded in z around 0 90.2%
if -2.99999999999999983e69 < x < 8.60000000000000027e-66Initial program 99.2%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 93.3%
div-sub93.3%
*-commutative93.3%
*-lft-identity93.3%
associate-*l/93.2%
associate-*r*93.2%
lft-mult-inverse93.4%
metadata-eval93.4%
Simplified93.4%
if 4.1999999999999997e39 < x Initial program 99.9%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around 0 90.4%
Taylor expanded in y around 0 89.1%
Final simplification91.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (* 4.0 (+ 0.75 (/ x y))))))
(if (<= x -3.2e+69)
t_0
(if (<= x 1.65e-63)
(+ 1.0 (* 4.0 (- 0.75 (/ z y))))
(if (<= x 2.4e+41) t_0 (+ 1.0 (* 4.0 (/ (- x z) y))))))))
double code(double x, double y, double z) {
double t_0 = 1.0 + (4.0 * (0.75 + (x / y)));
double tmp;
if (x <= -3.2e+69) {
tmp = t_0;
} else if (x <= 1.65e-63) {
tmp = 1.0 + (4.0 * (0.75 - (z / y)));
} else if (x <= 2.4e+41) {
tmp = t_0;
} else {
tmp = 1.0 + (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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (4.0d0 * (0.75d0 + (x / y)))
if (x <= (-3.2d+69)) then
tmp = t_0
else if (x <= 1.65d-63) then
tmp = 1.0d0 + (4.0d0 * (0.75d0 - (z / y)))
else if (x <= 2.4d+41) then
tmp = t_0
else
tmp = 1.0d0 + (4.0d0 * ((x - z) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 + (4.0 * (0.75 + (x / y)));
double tmp;
if (x <= -3.2e+69) {
tmp = t_0;
} else if (x <= 1.65e-63) {
tmp = 1.0 + (4.0 * (0.75 - (z / y)));
} else if (x <= 2.4e+41) {
tmp = t_0;
} else {
tmp = 1.0 + (4.0 * ((x - z) / y));
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + (4.0 * (0.75 + (x / y))) tmp = 0 if x <= -3.2e+69: tmp = t_0 elif x <= 1.65e-63: tmp = 1.0 + (4.0 * (0.75 - (z / y))) elif x <= 2.4e+41: tmp = t_0 else: tmp = 1.0 + (4.0 * ((x - z) / y)) return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(4.0 * Float64(0.75 + Float64(x / y)))) tmp = 0.0 if (x <= -3.2e+69) tmp = t_0; elseif (x <= 1.65e-63) tmp = Float64(1.0 + Float64(4.0 * Float64(0.75 - Float64(z / y)))); elseif (x <= 2.4e+41) tmp = t_0; else tmp = Float64(1.0 + Float64(4.0 * Float64(Float64(x - z) / y))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + (4.0 * (0.75 + (x / y))); tmp = 0.0; if (x <= -3.2e+69) tmp = t_0; elseif (x <= 1.65e-63) tmp = 1.0 + (4.0 * (0.75 - (z / y))); elseif (x <= 2.4e+41) tmp = t_0; else tmp = 1.0 + (4.0 * ((x - z) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(4.0 * N[(0.75 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.2e+69], t$95$0, If[LessEqual[x, 1.65e-63], N[(1.0 + N[(4.0 * N[(0.75 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.4e+41], t$95$0, N[(1.0 + N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + 4 \cdot \left(0.75 + \frac{x}{y}\right)\\
\mathbf{if}\;x \leq -3.2 \cdot 10^{+69}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{-63}:\\
\;\;\;\;1 + 4 \cdot \left(0.75 - \frac{z}{y}\right)\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+41}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;1 + 4 \cdot \frac{x - z}{y}\\
\end{array}
\end{array}
if x < -3.19999999999999985e69 or 1.64999999999999997e-63 < x < 2.4000000000000002e41Initial program 100.0%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around 0 97.2%
associate--l+97.2%
div-sub100.0%
Simplified100.0%
Taylor expanded in z around 0 90.2%
if -3.19999999999999985e69 < x < 1.64999999999999997e-63Initial program 99.2%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 93.3%
div-sub93.3%
*-commutative93.3%
*-lft-identity93.3%
associate-*l/93.2%
associate-*r*93.2%
lft-mult-inverse93.4%
metadata-eval93.4%
Simplified93.4%
if 2.4000000000000002e41 < x Initial program 99.9%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around 0 90.4%
Final simplification91.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.36e-5) (not (<= y 6.5e+92))) (+ 1.0 (* 4.0 (+ 0.75 (/ x y)))) (* 4.0 (/ (- x z) y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.36e-5) || !(y <= 6.5e+92)) {
tmp = 1.0 + (4.0 * (0.75 + (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 ((y <= (-1.36d-5)) .or. (.not. (y <= 6.5d+92))) then
tmp = 1.0d0 + (4.0d0 * (0.75d0 + (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 ((y <= -1.36e-5) || !(y <= 6.5e+92)) {
tmp = 1.0 + (4.0 * (0.75 + (x / y)));
} else {
tmp = 4.0 * ((x - z) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.36e-5) or not (y <= 6.5e+92): tmp = 1.0 + (4.0 * (0.75 + (x / y))) else: tmp = 4.0 * ((x - z) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.36e-5) || !(y <= 6.5e+92)) tmp = Float64(1.0 + Float64(4.0 * Float64(0.75 + Float64(x / y)))); else tmp = Float64(4.0 * Float64(Float64(x - z) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.36e-5) || ~((y <= 6.5e+92))) tmp = 1.0 + (4.0 * (0.75 + (x / y))); else tmp = 4.0 * ((x - z) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.36e-5], N[Not[LessEqual[y, 6.5e+92]], $MachinePrecision]], N[(1.0 + N[(4.0 * N[(0.75 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.36 \cdot 10^{-5} \lor \neg \left(y \leq 6.5 \cdot 10^{+92}\right):\\
\;\;\;\;1 + 4 \cdot \left(0.75 + \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\end{array}
\end{array}
if y < -1.36000000000000002e-5 or 6.49999999999999999e92 < y Initial program 99.1%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around 0 100.0%
associate--l+100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in z around 0 86.6%
if -1.36000000000000002e-5 < y < 6.49999999999999999e92Initial program 100.0%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 91.5%
Taylor expanded in y around 0 90.4%
Final simplification88.7%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.7e+69) (not (<= x 2.95e-64))) (* x (/ 4.0 y)) (* (/ z y) -4.0)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.7e+69) || !(x <= 2.95e-64)) {
tmp = x * (4.0 / y);
} else {
tmp = (z / y) * -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 ((x <= (-3.7d+69)) .or. (.not. (x <= 2.95d-64))) then
tmp = x * (4.0d0 / y)
else
tmp = (z / y) * (-4.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -3.7e+69) || !(x <= 2.95e-64)) {
tmp = x * (4.0 / y);
} else {
tmp = (z / y) * -4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.7e+69) or not (x <= 2.95e-64): tmp = x * (4.0 / y) else: tmp = (z / y) * -4.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.7e+69) || !(x <= 2.95e-64)) tmp = Float64(x * Float64(4.0 / y)); else tmp = Float64(Float64(z / y) * -4.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3.7e+69) || ~((x <= 2.95e-64))) tmp = x * (4.0 / y); else tmp = (z / y) * -4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.7e+69], N[Not[LessEqual[x, 2.95e-64]], $MachinePrecision]], N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision], N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{+69} \lor \neg \left(x \leq 2.95 \cdot 10^{-64}\right):\\
\;\;\;\;x \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{y} \cdot -4\\
\end{array}
\end{array}
if x < -3.6999999999999999e69 or 2.94999999999999997e-64 < x Initial program 99.9%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around -inf 99.9%
mul-1-neg99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
associate-*r/99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-lft-in99.9%
neg-mul-199.9%
remove-double-neg99.9%
neg-mul-199.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 79.9%
mul-1-neg79.9%
*-commutative79.9%
distribute-rgt-neg-in79.9%
sub-neg79.9%
metadata-eval79.9%
+-commutative79.9%
Simplified79.9%
Taylor expanded in x around inf 62.1%
*-commutative62.1%
associate-*l/62.1%
associate-/l*61.9%
Simplified61.9%
if -3.6999999999999999e69 < x < 2.94999999999999997e-64Initial program 99.2%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around -inf 72.1%
mul-1-neg72.1%
*-commutative72.1%
distribute-rgt-neg-in72.1%
sub-neg72.1%
metadata-eval72.1%
+-commutative72.1%
associate-*r/72.1%
sub-neg72.1%
+-commutative72.1%
*-commutative72.1%
distribute-lft-in72.1%
neg-mul-172.1%
remove-double-neg72.1%
neg-mul-172.1%
distribute-rgt-neg-in72.1%
metadata-eval72.1%
Simplified72.1%
Taylor expanded in y around 0 55.4%
mul-1-neg55.4%
*-commutative55.4%
distribute-rgt-neg-in55.4%
sub-neg55.4%
metadata-eval55.4%
+-commutative55.4%
Simplified55.4%
Taylor expanded in z around inf 50.1%
*-commutative50.1%
Simplified50.1%
Final simplification55.8%
(FPCore (x y z) :precision binary64 (* x (/ 4.0 y)))
double code(double x, double y, double z) {
return x * (4.0 / y);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x * (4.0d0 / y)
end function
public static double code(double x, double y, double z) {
return x * (4.0 / y);
}
def code(x, y, z): return x * (4.0 / y)
function code(x, y, z) return Float64(x * Float64(4.0 / y)) end
function tmp = code(x, y, z) tmp = x * (4.0 / y); end
code[x_, y_, z_] := N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{4}{y}
\end{array}
Initial program 99.6%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around -inf 85.6%
mul-1-neg85.6%
*-commutative85.6%
distribute-rgt-neg-in85.6%
sub-neg85.6%
metadata-eval85.6%
+-commutative85.6%
associate-*r/85.6%
sub-neg85.6%
+-commutative85.6%
*-commutative85.6%
distribute-lft-in85.6%
neg-mul-185.6%
remove-double-neg85.6%
neg-mul-185.6%
distribute-rgt-neg-in85.6%
metadata-eval85.6%
Simplified85.6%
Taylor expanded in y around 0 67.3%
mul-1-neg67.3%
*-commutative67.3%
distribute-rgt-neg-in67.3%
sub-neg67.3%
metadata-eval67.3%
+-commutative67.3%
Simplified67.3%
Taylor expanded in x around inf 34.6%
*-commutative34.6%
associate-*l/34.6%
associate-/l*34.5%
Simplified34.5%
Final simplification34.5%
(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.6%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in z around inf 38.3%
neg-mul-138.3%
distribute-neg-frac238.3%
Simplified38.3%
Taylor expanded in z around 0 7.8%
Final simplification7.8%
herbie shell --seed 2024071
(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)))