
(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 (fma 4.0 (+ 0.75 (/ (- x z) y)) 1.0))
double code(double x, double y, double z) {
return fma(4.0, (0.75 + ((x - z) / y)), 1.0);
}
function code(x, y, z) return fma(4.0, Float64(0.75 + Float64(Float64(x - z) / y)), 1.0) end
code[x_, y_, z_] := N[(4.0 * N[(0.75 + N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(4, 0.75 + \frac{x - z}{y}, 1\right)
\end{array}
Initial program 99.6%
+-commutative99.6%
associate-/l*100.0%
fma-define100.0%
associate--l+100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
associate--r+100.0%
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%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.9e+157) (not (<= y 2.85e+104))) (+ 4.0 (* x (/ 4.0 y))) (* 4.0 (/ (- x z) y))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.9e+157) || !(y <= 2.85e+104)) {
tmp = 4.0 + (x * (4.0 / 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 <= (-2.9d+157)) .or. (.not. (y <= 2.85d+104))) then
tmp = 4.0d0 + (x * (4.0d0 / 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 <= -2.9e+157) || !(y <= 2.85e+104)) {
tmp = 4.0 + (x * (4.0 / y));
} else {
tmp = 4.0 * ((x - z) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.9e+157) or not (y <= 2.85e+104): tmp = 4.0 + (x * (4.0 / y)) else: tmp = 4.0 * ((x - z) / y) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.9e+157) || !(y <= 2.85e+104)) tmp = Float64(4.0 + Float64(x * Float64(4.0 / 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 <= -2.9e+157) || ~((y <= 2.85e+104))) tmp = 4.0 + (x * (4.0 / y)); else tmp = 4.0 * ((x - z) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.9e+157], N[Not[LessEqual[y, 2.85e+104]], $MachinePrecision]], N[(4.0 + N[(x * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{+157} \lor \neg \left(y \leq 2.85 \cdot 10^{+104}\right):\\
\;\;\;\;4 + x \cdot \frac{4}{y}\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\end{array}
\end{array}
if y < -2.89999999999999988e157 or 2.84999999999999993e104 < y Initial program 98.7%
+-commutative98.7%
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.9%
distribute-lft-in87.9%
metadata-eval87.9%
associate-+r+87.9%
metadata-eval87.9%
*-commutative87.9%
associate-*l/86.7%
associate-*r/87.9%
Simplified87.9%
if -2.89999999999999988e157 < y < 2.84999999999999993e104Initial program 100.0%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 87.0%
*-commutative87.0%
Simplified87.0%
Final simplification87.3%
(FPCore (x y z) :precision binary64 (if (<= x -2.7e+124) (* 4.0 (/ (- x z) y)) (if (<= x 3.65e-22) (+ 4.0 (/ (* z -4.0) y)) (+ 4.0 (/ (* 4.0 x) y)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.7e+124) {
tmp = 4.0 * ((x - z) / y);
} else if (x <= 3.65e-22) {
tmp = 4.0 + ((z * -4.0) / y);
} else {
tmp = 4.0 + ((4.0 * x) / 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+124)) then
tmp = 4.0d0 * ((x - z) / y)
else if (x <= 3.65d-22) then
tmp = 4.0d0 + ((z * (-4.0d0)) / y)
else
tmp = 4.0d0 + ((4.0d0 * x) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2.7e+124) {
tmp = 4.0 * ((x - z) / y);
} else if (x <= 3.65e-22) {
tmp = 4.0 + ((z * -4.0) / y);
} else {
tmp = 4.0 + ((4.0 * x) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.7e+124: tmp = 4.0 * ((x - z) / y) elif x <= 3.65e-22: tmp = 4.0 + ((z * -4.0) / y) else: tmp = 4.0 + ((4.0 * x) / y) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.7e+124) tmp = Float64(4.0 * Float64(Float64(x - z) / y)); elseif (x <= 3.65e-22) tmp = Float64(4.0 + Float64(Float64(z * -4.0) / y)); else tmp = Float64(4.0 + Float64(Float64(4.0 * x) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.7e+124) tmp = 4.0 * ((x - z) / y); elseif (x <= 3.65e-22) tmp = 4.0 + ((z * -4.0) / y); else tmp = 4.0 + ((4.0 * x) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.7e+124], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.65e-22], N[(4.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(4.0 + N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{+124}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{elif}\;x \leq 3.65 \cdot 10^{-22}:\\
\;\;\;\;4 + \frac{z \cdot -4}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + \frac{4 \cdot x}{y}\\
\end{array}
\end{array}
if x < -2.69999999999999978e124Initial program 97.1%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 91.2%
*-commutative91.2%
Simplified91.2%
if -2.69999999999999978e124 < x < 3.65000000000000014e-22Initial program 100.0%
+-commutative100.0%
associate-/l*100.0%
fma-define100.0%
associate--l+100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
associate--r+100.0%
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 91.9%
sub-neg91.9%
distribute-lft-in91.9%
metadata-eval91.9%
associate-+r+91.9%
metadata-eval91.9%
neg-mul-191.9%
associate-*r*91.9%
metadata-eval91.9%
*-commutative91.9%
associate-*l/91.9%
Simplified91.9%
if 3.65000000000000014e-22 < 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 88.1%
distribute-lft-in88.1%
metadata-eval88.1%
associate-+r+88.1%
metadata-eval88.1%
*-commutative88.1%
associate-*l/88.1%
associate-*r/87.9%
Simplified87.9%
*-commutative87.9%
associate-*l/88.1%
Applied egg-rr88.1%
Final simplification90.6%
(FPCore (x y z) :precision binary64 (if (<= y -1.08e+158) 4.0 (if (<= y 5.2e+109) (* 4.0 (/ (- x z) y)) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.08e+158) {
tmp = 4.0;
} else if (y <= 5.2e+109) {
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 <= (-1.08d+158)) then
tmp = 4.0d0
else if (y <= 5.2d+109) 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 <= -1.08e+158) {
tmp = 4.0;
} else if (y <= 5.2e+109) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.08e+158: tmp = 4.0 elif y <= 5.2e+109: tmp = 4.0 * ((x - z) / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.08e+158) tmp = 4.0; elseif (y <= 5.2e+109) 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 <= -1.08e+158) tmp = 4.0; elseif (y <= 5.2e+109) tmp = 4.0 * ((x - z) / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.08e+158], 4.0, If[LessEqual[y, 5.2e+109], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.08 \cdot 10^{+158}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{+109}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -1.08e158 or 5.1999999999999997e109 < y Initial program 98.7%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around inf 75.3%
if -1.08e158 < y < 5.1999999999999997e109Initial program 100.0%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 87.0%
*-commutative87.0%
Simplified87.0%
Final simplification83.3%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.1e+71) (not (<= x 2.7e-22))) (* 4.0 (/ x y)) (/ (* z -4.0) y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.1e+71) || !(x <= 2.7e-22)) {
tmp = 4.0 * (x / y);
} else {
tmp = (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 <= (-3.1d+71)) .or. (.not. (x <= 2.7d-22))) then
tmp = 4.0d0 * (x / y)
else
tmp = (z * (-4.0d0)) / y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -3.1e+71) || !(x <= 2.7e-22)) {
tmp = 4.0 * (x / y);
} else {
tmp = (z * -4.0) / y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.1e+71) or not (x <= 2.7e-22): tmp = 4.0 * (x / y) else: tmp = (z * -4.0) / y return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.1e+71) || !(x <= 2.7e-22)) tmp = Float64(4.0 * Float64(x / y)); else tmp = Float64(Float64(z * -4.0) / y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -3.1e+71) || ~((x <= 2.7e-22))) tmp = 4.0 * (x / y); else tmp = (z * -4.0) / y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.1e+71], N[Not[LessEqual[x, 2.7e-22]], $MachinePrecision]], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{+71} \lor \neg \left(x \leq 2.7 \cdot 10^{-22}\right):\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot -4}{y}\\
\end{array}
\end{array}
if x < -3.10000000000000018e71 or 2.7000000000000002e-22 < x Initial program 99.2%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around inf 63.6%
*-commutative63.6%
Simplified63.6%
if -3.10000000000000018e71 < x < 2.7000000000000002e-22Initial program 100.0%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around inf 54.0%
*-commutative54.0%
associate-*l/54.0%
Simplified54.0%
Final simplification58.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.6e+72) (not (<= x 3.85e-23))) (* 4.0 (/ x y)) (* z (/ -4.0 y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.6e+72) || !(x <= 3.85e-23)) {
tmp = 4.0 * (x / y);
} else {
tmp = 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+72)) .or. (.not. (x <= 3.85d-23))) then
tmp = 4.0d0 * (x / y)
else
tmp = 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+72) || !(x <= 3.85e-23)) {
tmp = 4.0 * (x / y);
} else {
tmp = z * (-4.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.6e+72) or not (x <= 3.85e-23): tmp = 4.0 * (x / y) else: tmp = z * (-4.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.6e+72) || !(x <= 3.85e-23)) tmp = Float64(4.0 * Float64(x / y)); else tmp = Float64(z * Float64(-4.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -4.6e+72) || ~((x <= 3.85e-23))) tmp = 4.0 * (x / y); else tmp = z * (-4.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.6e+72], N[Not[LessEqual[x, 3.85e-23]], $MachinePrecision]], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6 \cdot 10^{+72} \lor \neg \left(x \leq 3.85 \cdot 10^{-23}\right):\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-4}{y}\\
\end{array}
\end{array}
if x < -4.6e72 or 3.84999999999999975e-23 < x Initial program 99.2%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in x around inf 63.6%
*-commutative63.6%
Simplified63.6%
if -4.6e72 < x < 3.84999999999999975e-23Initial program 100.0%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around inf 54.0%
*-commutative54.0%
associate-*l/54.0%
Simplified54.0%
associate-/l*53.8%
*-commutative53.8%
Applied egg-rr53.8%
Final simplification58.5%
(FPCore (x y z) :precision binary64 (if (<= y -6.4e+158) 4.0 (if (<= y 1.45e+107) (* z (/ -4.0 y)) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -6.4e+158) {
tmp = 4.0;
} else if (y <= 1.45e+107) {
tmp = z * (-4.0 / 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 <= (-6.4d+158)) then
tmp = 4.0d0
else if (y <= 1.45d+107) then
tmp = z * ((-4.0d0) / 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 <= -6.4e+158) {
tmp = 4.0;
} else if (y <= 1.45e+107) {
tmp = z * (-4.0 / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6.4e+158: tmp = 4.0 elif y <= 1.45e+107: tmp = z * (-4.0 / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6.4e+158) tmp = 4.0; elseif (y <= 1.45e+107) tmp = Float64(z * Float64(-4.0 / y)); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -6.4e+158) tmp = 4.0; elseif (y <= 1.45e+107) tmp = z * (-4.0 / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6.4e+158], 4.0, If[LessEqual[y, 1.45e+107], N[(z * N[(-4.0 / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.4 \cdot 10^{+158}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{+107}:\\
\;\;\;\;z \cdot \frac{-4}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -6.39999999999999989e158 or 1.44999999999999994e107 < y Initial program 98.7%
associate-/l*99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around inf 75.3%
if -6.39999999999999989e158 < y < 1.44999999999999994e107Initial program 100.0%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around inf 46.5%
*-commutative46.5%
associate-*l/46.5%
Simplified46.5%
associate-/l*46.3%
*-commutative46.3%
Applied egg-rr46.3%
Final simplification55.5%
(FPCore (x y z) :precision binary64 (+ 1.0 (* 4.0 (/ (+ x (- (* 0.75 y) z)) y))))
double code(double x, double y, double z) {
return 1.0 + (4.0 * ((x + ((0.75 * y) - 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 + ((0.75d0 * y) - z)) / y))
end function
public static double code(double x, double y, double z) {
return 1.0 + (4.0 * ((x + ((0.75 * y) - z)) / y));
}
def code(x, y, z): return 1.0 + (4.0 * ((x + ((0.75 * y) - z)) / y))
function code(x, y, z) return Float64(1.0 + Float64(4.0 * Float64(Float64(x + Float64(Float64(0.75 * y) - z)) / y))) end
function tmp = code(x, y, z) tmp = 1.0 + (4.0 * ((x + ((0.75 * y) - z)) / y)); end
code[x_, y_, z_] := N[(1.0 + N[(4.0 * N[(N[(x + N[(N[(0.75 * y), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + 4 \cdot \frac{x + \left(0.75 \cdot y - z\right)}{y}
\end{array}
Initial program 99.6%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (/ (* 4.0 (+ (- x z) y)) y))
double code(double x, double y, double z) {
return (4.0 * ((x - z) + y)) / 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 * ((x - z) + y)) / y
end function
public static double code(double x, double y, double z) {
return (4.0 * ((x - z) + y)) / y;
}
def code(x, y, z): return (4.0 * ((x - z) + y)) / y
function code(x, y, z) return Float64(Float64(4.0 * Float64(Float64(x - z) + y)) / y) end
function tmp = code(x, y, z) tmp = (4.0 * ((x - z) + y)) / y; end
code[x_, y_, z_] := N[(N[(4.0 * N[(N[(x - z), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{4 \cdot \left(\left(x - z\right) + y\right)}{y}
\end{array}
Initial program 99.6%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 99.6%
distribute-lft-out99.6%
Simplified99.6%
Final simplification99.6%
(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.6%
associate-/l*100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around inf 32.8%
herbie shell --seed 2024137
(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)))