
(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 (+ 4.0 (* 4.0 (/ (- x z) y))))
double code(double x, double y, double z) {
return 4.0 + (4.0 * ((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 + (4.0d0 * ((x - z) / y))
end function
public static double code(double x, double y, double z) {
return 4.0 + (4.0 * ((x - z) / y));
}
def code(x, y, z): return 4.0 + (4.0 * ((x - z) / y))
function code(x, y, z) return Float64(4.0 + Float64(4.0 * Float64(Float64(x - z) / y))) end
function tmp = code(x, y, z) tmp = 4.0 + (4.0 * ((x - z) / y)); end
code[x_, y_, z_] := N[(4.0 + N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
4 + 4 \cdot \frac{x - z}{y}
\end{array}
Initial program 99.9%
Taylor expanded in y around inf 100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* z -4.0) y)) (t_1 (* 4.0 (/ x y))))
(if (<= x -7.4e+95)
t_1
(if (<= x -3.5e-308)
4.0
(if (<= x 5e-252)
t_0
(if (<= x 8.2e-234)
4.0
(if (<= x 3.4e-200) t_0 (if (<= x 9.8e+50) 4.0 t_1))))))))
double code(double x, double y, double z) {
double t_0 = (z * -4.0) / y;
double t_1 = 4.0 * (x / y);
double tmp;
if (x <= -7.4e+95) {
tmp = t_1;
} else if (x <= -3.5e-308) {
tmp = 4.0;
} else if (x <= 5e-252) {
tmp = t_0;
} else if (x <= 8.2e-234) {
tmp = 4.0;
} else if (x <= 3.4e-200) {
tmp = t_0;
} else if (x <= 9.8e+50) {
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 = (z * (-4.0d0)) / y
t_1 = 4.0d0 * (x / y)
if (x <= (-7.4d+95)) then
tmp = t_1
else if (x <= (-3.5d-308)) then
tmp = 4.0d0
else if (x <= 5d-252) then
tmp = t_0
else if (x <= 8.2d-234) then
tmp = 4.0d0
else if (x <= 3.4d-200) then
tmp = t_0
else if (x <= 9.8d+50) 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 = (z * -4.0) / y;
double t_1 = 4.0 * (x / y);
double tmp;
if (x <= -7.4e+95) {
tmp = t_1;
} else if (x <= -3.5e-308) {
tmp = 4.0;
} else if (x <= 5e-252) {
tmp = t_0;
} else if (x <= 8.2e-234) {
tmp = 4.0;
} else if (x <= 3.4e-200) {
tmp = t_0;
} else if (x <= 9.8e+50) {
tmp = 4.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = (z * -4.0) / y t_1 = 4.0 * (x / y) tmp = 0 if x <= -7.4e+95: tmp = t_1 elif x <= -3.5e-308: tmp = 4.0 elif x <= 5e-252: tmp = t_0 elif x <= 8.2e-234: tmp = 4.0 elif x <= 3.4e-200: tmp = t_0 elif x <= 9.8e+50: tmp = 4.0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(Float64(z * -4.0) / y) t_1 = Float64(4.0 * Float64(x / y)) tmp = 0.0 if (x <= -7.4e+95) tmp = t_1; elseif (x <= -3.5e-308) tmp = 4.0; elseif (x <= 5e-252) tmp = t_0; elseif (x <= 8.2e-234) tmp = 4.0; elseif (x <= 3.4e-200) tmp = t_0; elseif (x <= 9.8e+50) tmp = 4.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z * -4.0) / y; t_1 = 4.0 * (x / y); tmp = 0.0; if (x <= -7.4e+95) tmp = t_1; elseif (x <= -3.5e-308) tmp = 4.0; elseif (x <= 5e-252) tmp = t_0; elseif (x <= 8.2e-234) tmp = 4.0; elseif (x <= 3.4e-200) tmp = t_0; elseif (x <= 9.8e+50) tmp = 4.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.4e+95], t$95$1, If[LessEqual[x, -3.5e-308], 4.0, If[LessEqual[x, 5e-252], t$95$0, If[LessEqual[x, 8.2e-234], 4.0, If[LessEqual[x, 3.4e-200], t$95$0, If[LessEqual[x, 9.8e+50], 4.0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z \cdot -4}{y}\\
t_1 := 4 \cdot \frac{x}{y}\\
\mathbf{if}\;x \leq -7.4 \cdot 10^{+95}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -3.5 \cdot 10^{-308}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-252}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{-234}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{-200}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 9.8 \cdot 10^{+50}:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -7.4000000000000003e95 or 9.8000000000000003e50 < 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-sub100.0%
sub-neg100.0%
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 85.3%
distribute-lft-in85.3%
metadata-eval85.3%
associate-+r+85.3%
metadata-eval85.3%
associate-*r/85.3%
*-commutative85.3%
associate-*r/85.1%
Simplified85.1%
associate-*r/85.3%
*-commutative85.3%
Applied egg-rr85.3%
Taylor expanded in x around inf 75.7%
if -7.4000000000000003e95 < x < -3.5e-308 or 5.00000000000000008e-252 < x < 8.20000000000000021e-234 or 3.4000000000000003e-200 < x < 9.8000000000000003e50Initial program 99.9%
Taylor expanded in y around inf 55.6%
if -3.5e-308 < x < 5.00000000000000008e-252 or 8.20000000000000021e-234 < x < 3.4000000000000003e-200Initial program 100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around 0 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in z around inf 79.8%
associate-*r/79.8%
Simplified79.8%
Final simplification64.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (/ -4.0 y))) (t_1 (* 4.0 (/ x y))))
(if (<= x -6.5e+95)
t_1
(if (<= x -3.4e-303)
4.0
(if (<= x 5.2e-252)
t_0
(if (<= x 7.2e-234)
4.0
(if (<= x 4.4e-201) t_0 (if (<= x 6.5e+50) 4.0 t_1))))))))
double code(double x, double y, double z) {
double t_0 = z * (-4.0 / y);
double t_1 = 4.0 * (x / y);
double tmp;
if (x <= -6.5e+95) {
tmp = t_1;
} else if (x <= -3.4e-303) {
tmp = 4.0;
} else if (x <= 5.2e-252) {
tmp = t_0;
} else if (x <= 7.2e-234) {
tmp = 4.0;
} else if (x <= 4.4e-201) {
tmp = t_0;
} else if (x <= 6.5e+50) {
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 = z * ((-4.0d0) / y)
t_1 = 4.0d0 * (x / y)
if (x <= (-6.5d+95)) then
tmp = t_1
else if (x <= (-3.4d-303)) then
tmp = 4.0d0
else if (x <= 5.2d-252) then
tmp = t_0
else if (x <= 7.2d-234) then
tmp = 4.0d0
else if (x <= 4.4d-201) then
tmp = t_0
else if (x <= 6.5d+50) 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 = z * (-4.0 / y);
double t_1 = 4.0 * (x / y);
double tmp;
if (x <= -6.5e+95) {
tmp = t_1;
} else if (x <= -3.4e-303) {
tmp = 4.0;
} else if (x <= 5.2e-252) {
tmp = t_0;
} else if (x <= 7.2e-234) {
tmp = 4.0;
} else if (x <= 4.4e-201) {
tmp = t_0;
} else if (x <= 6.5e+50) {
tmp = 4.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = z * (-4.0 / y) t_1 = 4.0 * (x / y) tmp = 0 if x <= -6.5e+95: tmp = t_1 elif x <= -3.4e-303: tmp = 4.0 elif x <= 5.2e-252: tmp = t_0 elif x <= 7.2e-234: tmp = 4.0 elif x <= 4.4e-201: tmp = t_0 elif x <= 6.5e+50: tmp = 4.0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(-4.0 / y)) t_1 = Float64(4.0 * Float64(x / y)) tmp = 0.0 if (x <= -6.5e+95) tmp = t_1; elseif (x <= -3.4e-303) tmp = 4.0; elseif (x <= 5.2e-252) tmp = t_0; elseif (x <= 7.2e-234) tmp = 4.0; elseif (x <= 4.4e-201) tmp = t_0; elseif (x <= 6.5e+50) tmp = 4.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (-4.0 / y); t_1 = 4.0 * (x / y); tmp = 0.0; if (x <= -6.5e+95) tmp = t_1; elseif (x <= -3.4e-303) tmp = 4.0; elseif (x <= 5.2e-252) tmp = t_0; elseif (x <= 7.2e-234) tmp = 4.0; elseif (x <= 4.4e-201) tmp = t_0; elseif (x <= 6.5e+50) tmp = 4.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.5e+95], t$95$1, If[LessEqual[x, -3.4e-303], 4.0, If[LessEqual[x, 5.2e-252], t$95$0, If[LessEqual[x, 7.2e-234], 4.0, If[LessEqual[x, 4.4e-201], t$95$0, If[LessEqual[x, 6.5e+50], 4.0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \frac{-4}{y}\\
t_1 := 4 \cdot \frac{x}{y}\\
\mathbf{if}\;x \leq -6.5 \cdot 10^{+95}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -3.4 \cdot 10^{-303}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-252}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{-234}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{-201}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+50}:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -6.5e95 or 6.5000000000000003e50 < 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-sub100.0%
sub-neg100.0%
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 85.3%
distribute-lft-in85.3%
metadata-eval85.3%
associate-+r+85.3%
metadata-eval85.3%
associate-*r/85.3%
*-commutative85.3%
associate-*r/85.1%
Simplified85.1%
associate-*r/85.3%
*-commutative85.3%
Applied egg-rr85.3%
Taylor expanded in x around inf 75.7%
if -6.5e95 < x < -3.4e-303 or 5.1999999999999998e-252 < x < 7.1999999999999997e-234 or 4.4e-201 < x < 6.5000000000000003e50Initial program 99.9%
Taylor expanded in y around inf 55.6%
if -3.4e-303 < x < 5.1999999999999998e-252 or 7.1999999999999997e-234 < x < 4.4e-201Initial program 100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around 0 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in z around inf 79.8%
*-commutative79.8%
associate-*l/79.8%
associate-*r/79.5%
Simplified79.5%
(FPCore (x y z)
:precision binary64
(if (or (<= z -1.35e+70)
(and (not (<= z -4.8e+14)) (or (<= z -4.8e-21) (not (<= z 1.9e+87)))))
(* 4.0 (/ (- x z) y))
(+ 4.0 (* x (/ 4.0 y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.35e+70) || (!(z <= -4.8e+14) && ((z <= -4.8e-21) || !(z <= 1.9e+87)))) {
tmp = 4.0 * ((x - 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 <= (-1.35d+70)) .or. (.not. (z <= (-4.8d+14))) .and. (z <= (-4.8d-21)) .or. (.not. (z <= 1.9d+87))) then
tmp = 4.0d0 * ((x - 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 <= -1.35e+70) || (!(z <= -4.8e+14) && ((z <= -4.8e-21) || !(z <= 1.9e+87)))) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.0 + (x * (4.0 / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.35e+70) or (not (z <= -4.8e+14) and ((z <= -4.8e-21) or not (z <= 1.9e+87))): tmp = 4.0 * ((x - z) / y) else: tmp = 4.0 + (x * (4.0 / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.35e+70) || (!(z <= -4.8e+14) && ((z <= -4.8e-21) || !(z <= 1.9e+87)))) tmp = Float64(4.0 * Float64(Float64(x - 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 <= -1.35e+70) || (~((z <= -4.8e+14)) && ((z <= -4.8e-21) || ~((z <= 1.9e+87))))) tmp = 4.0 * ((x - z) / y); else tmp = 4.0 + (x * (4.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.35e+70], And[N[Not[LessEqual[z, -4.8e+14]], $MachinePrecision], Or[LessEqual[z, -4.8e-21], N[Not[LessEqual[z, 1.9e+87]], $MachinePrecision]]]], N[(4.0 * N[(N[(x - z), $MachinePrecision] / 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 -1.35 \cdot 10^{+70} \lor \neg \left(z \leq -4.8 \cdot 10^{+14}\right) \land \left(z \leq -4.8 \cdot 10^{-21} \lor \neg \left(z \leq 1.9 \cdot 10^{+87}\right)\right):\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + x \cdot \frac{4}{y}\\
\end{array}
\end{array}
if z < -1.35e70 or -4.8e14 < z < -4.7999999999999999e-21 or 1.90000000000000006e87 < z Initial program 100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in y around 0 83.1%
if -1.35e70 < z < -4.8e14 or -4.7999999999999999e-21 < z < 1.90000000000000006e87Initial 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.9%
distribute-lft-in90.9%
metadata-eval90.9%
associate-+r+90.9%
metadata-eval90.9%
associate-*r/90.9%
*-commutative90.9%
associate-*r/90.9%
Simplified90.9%
Final simplification87.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.6e+94) (not (<= x 6.5e+50))) (* 4.0 (/ (- x z) y)) (+ 4.0 (/ (* z -4.0) y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.6e+94) || !(x <= 6.5e+50)) {
tmp = 4.0 * ((x - z) / 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 <= (-4.6d+94)) .or. (.not. (x <= 6.5d+50))) then
tmp = 4.0d0 * ((x - z) / 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 <= -4.6e+94) || !(x <= 6.5e+50)) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.0 + ((z * -4.0) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.6e+94) or not (x <= 6.5e+50): tmp = 4.0 * ((x - z) / y) else: tmp = 4.0 + ((z * -4.0) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.6e+94) || !(x <= 6.5e+50)) tmp = Float64(4.0 * Float64(Float64(x - z) / 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 <= -4.6e+94) || ~((x <= 6.5e+50))) tmp = 4.0 * ((x - z) / y); else tmp = 4.0 + ((z * -4.0) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.6e+94], N[Not[LessEqual[x, 6.5e+50]], $MachinePrecision]], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(4.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6 \cdot 10^{+94} \lor \neg \left(x \leq 6.5 \cdot 10^{+50}\right):\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + \frac{z \cdot -4}{y}\\
\end{array}
\end{array}
if x < -4.5999999999999999e94 or 6.5000000000000003e50 < x Initial program 99.9%
Taylor expanded in y around inf 100.0%
Taylor expanded in y around 0 90.4%
if -4.5999999999999999e94 < x < 6.5000000000000003e50Initial program 99.9%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around 0 88.0%
associate-*r/88.0%
Simplified88.0%
Final simplification88.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.7e+95) (not (<= x 8.6e+50))) (* 4.0 (/ (- x z) y)) (+ 4.0 (* z (/ -4.0 y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.7e+95) || !(x <= 8.6e+50)) {
tmp = 4.0 * ((x - z) / 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 <= (-2.7d+95)) .or. (.not. (x <= 8.6d+50))) then
tmp = 4.0d0 * ((x - z) / 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 <= -2.7e+95) || !(x <= 8.6e+50)) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.0 + (z * (-4.0 / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.7e+95) or not (x <= 8.6e+50): tmp = 4.0 * ((x - z) / y) else: tmp = 4.0 + (z * (-4.0 / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.7e+95) || !(x <= 8.6e+50)) tmp = Float64(4.0 * Float64(Float64(x - z) / y)); else tmp = Float64(4.0 + Float64(z * Float64(-4.0 / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.7e+95) || ~((x <= 8.6e+50))) tmp = 4.0 * ((x - z) / y); else tmp = 4.0 + (z * (-4.0 / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.7e+95], N[Not[LessEqual[x, 8.6e+50]], $MachinePrecision]], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(4.0 + N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{+95} \lor \neg \left(x \leq 8.6 \cdot 10^{+50}\right):\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + z \cdot \frac{-4}{y}\\
\end{array}
\end{array}
if x < -2.7e95 or 8.5999999999999994e50 < x Initial program 99.9%
Taylor expanded in y around inf 100.0%
Taylor expanded in y around 0 90.4%
if -2.7e95 < x < 8.5999999999999994e50Initial 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-sub100.0%
sub-neg100.0%
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 x around 0 88.0%
sub-neg88.0%
distribute-lft-in88.0%
metadata-eval88.0%
associate-+r+88.0%
metadata-eval88.0%
neg-mul-188.0%
associate-*r*88.0%
metadata-eval88.0%
associate-*r/88.0%
*-commutative88.0%
associate-/l*87.9%
Simplified87.9%
Final simplification88.9%
(FPCore (x y z) :precision binary64 (if (<= y -4.2e+104) 4.0 (if (<= y 6e+121) (* 4.0 (/ (- x z) y)) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.2e+104) {
tmp = 4.0;
} else if (y <= 6e+121) {
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 <= (-4.2d+104)) then
tmp = 4.0d0
else if (y <= 6d+121) 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 <= -4.2e+104) {
tmp = 4.0;
} else if (y <= 6e+121) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.2e+104: tmp = 4.0 elif y <= 6e+121: tmp = 4.0 * ((x - z) / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.2e+104) tmp = 4.0; elseif (y <= 6e+121) 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 <= -4.2e+104) tmp = 4.0; elseif (y <= 6e+121) tmp = 4.0 * ((x - z) / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.2e+104], 4.0, If[LessEqual[y, 6e+121], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{+104}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+121}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -4.1999999999999997e104 or 6.0000000000000005e121 < y Initial program 99.9%
Taylor expanded in y around inf 74.1%
if -4.1999999999999997e104 < y < 6.0000000000000005e121Initial program 100.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in y around 0 81.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.4e+94) (not (<= x 5.4e+50))) (* 4.0 (/ x y)) 4.0))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.4e+94) || !(x <= 5.4e+50)) {
tmp = 4.0 * (x / 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 ((x <= (-2.4d+94)) .or. (.not. (x <= 5.4d+50))) then
tmp = 4.0d0 * (x / y)
else
tmp = 4.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -2.4e+94) || !(x <= 5.4e+50)) {
tmp = 4.0 * (x / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.4e+94) or not (x <= 5.4e+50): tmp = 4.0 * (x / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.4e+94) || !(x <= 5.4e+50)) tmp = Float64(4.0 * Float64(x / y)); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -2.4e+94) || ~((x <= 5.4e+50))) tmp = 4.0 * (x / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.4e+94], N[Not[LessEqual[x, 5.4e+50]], $MachinePrecision]], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], 4.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{+94} \lor \neg \left(x \leq 5.4 \cdot 10^{+50}\right):\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if x < -2.39999999999999983e94 or 5.4e50 < 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-sub100.0%
sub-neg100.0%
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 85.3%
distribute-lft-in85.3%
metadata-eval85.3%
associate-+r+85.3%
metadata-eval85.3%
associate-*r/85.3%
*-commutative85.3%
associate-*r/85.1%
Simplified85.1%
associate-*r/85.3%
*-commutative85.3%
Applied egg-rr85.3%
Taylor expanded in x around inf 75.7%
if -2.39999999999999983e94 < x < 5.4e50Initial program 99.9%
Taylor expanded in y around inf 51.7%
Final simplification60.7%
(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 36.2%
(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 41.8%
*-commutative41.8%
Simplified41.8%
Taylor expanded in x around 0 8.0%
herbie shell --seed 2024110
(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)))