
(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 7 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.2%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
distribute-lft-in99.7%
associate-+r+99.7%
*-commutative99.7%
+-commutative99.7%
fma-def99.7%
associate-*r*99.7%
associate-*l/99.4%
associate-/l*99.8%
*-inverses99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 100.0%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 4.0 (/ x y))) (t_1 (* (/ z y) -4.0)))
(if (<= z -4.1e+140)
t_1
(if (<= z -3.2e+56)
4.0
(if (<= z -2.8e+37)
t_1
(if (<= z -1.46e-93)
t_0
(if (<= z -3.7e-190)
4.0
(if (<= z 1.9e-222) t_0 (if (<= z 9e+68) 4.0 t_1)))))))))
double code(double x, double y, double z) {
double t_0 = 4.0 * (x / y);
double t_1 = (z / y) * -4.0;
double tmp;
if (z <= -4.1e+140) {
tmp = t_1;
} else if (z <= -3.2e+56) {
tmp = 4.0;
} else if (z <= -2.8e+37) {
tmp = t_1;
} else if (z <= -1.46e-93) {
tmp = t_0;
} else if (z <= -3.7e-190) {
tmp = 4.0;
} else if (z <= 1.9e-222) {
tmp = t_0;
} else if (z <= 9e+68) {
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 * (x / y)
t_1 = (z / y) * (-4.0d0)
if (z <= (-4.1d+140)) then
tmp = t_1
else if (z <= (-3.2d+56)) then
tmp = 4.0d0
else if (z <= (-2.8d+37)) then
tmp = t_1
else if (z <= (-1.46d-93)) then
tmp = t_0
else if (z <= (-3.7d-190)) then
tmp = 4.0d0
else if (z <= 1.9d-222) then
tmp = t_0
else if (z <= 9d+68) 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 * (x / y);
double t_1 = (z / y) * -4.0;
double tmp;
if (z <= -4.1e+140) {
tmp = t_1;
} else if (z <= -3.2e+56) {
tmp = 4.0;
} else if (z <= -2.8e+37) {
tmp = t_1;
} else if (z <= -1.46e-93) {
tmp = t_0;
} else if (z <= -3.7e-190) {
tmp = 4.0;
} else if (z <= 1.9e-222) {
tmp = t_0;
} else if (z <= 9e+68) {
tmp = 4.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 4.0 * (x / y) t_1 = (z / y) * -4.0 tmp = 0 if z <= -4.1e+140: tmp = t_1 elif z <= -3.2e+56: tmp = 4.0 elif z <= -2.8e+37: tmp = t_1 elif z <= -1.46e-93: tmp = t_0 elif z <= -3.7e-190: tmp = 4.0 elif z <= 1.9e-222: tmp = t_0 elif z <= 9e+68: tmp = 4.0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(4.0 * Float64(x / y)) t_1 = Float64(Float64(z / y) * -4.0) tmp = 0.0 if (z <= -4.1e+140) tmp = t_1; elseif (z <= -3.2e+56) tmp = 4.0; elseif (z <= -2.8e+37) tmp = t_1; elseif (z <= -1.46e-93) tmp = t_0; elseif (z <= -3.7e-190) tmp = 4.0; elseif (z <= 1.9e-222) tmp = t_0; elseif (z <= 9e+68) tmp = 4.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 4.0 * (x / y); t_1 = (z / y) * -4.0; tmp = 0.0; if (z <= -4.1e+140) tmp = t_1; elseif (z <= -3.2e+56) tmp = 4.0; elseif (z <= -2.8e+37) tmp = t_1; elseif (z <= -1.46e-93) tmp = t_0; elseif (z <= -3.7e-190) tmp = 4.0; elseif (z <= 1.9e-222) tmp = t_0; elseif (z <= 9e+68) tmp = 4.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]}, If[LessEqual[z, -4.1e+140], t$95$1, If[LessEqual[z, -3.2e+56], 4.0, If[LessEqual[z, -2.8e+37], t$95$1, If[LessEqual[z, -1.46e-93], t$95$0, If[LessEqual[z, -3.7e-190], 4.0, If[LessEqual[z, 1.9e-222], t$95$0, If[LessEqual[z, 9e+68], 4.0, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 4 \cdot \frac{x}{y}\\
t_1 := \frac{z}{y} \cdot -4\\
\mathbf{if}\;z \leq -4.1 \cdot 10^{+140}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{+56}:\\
\;\;\;\;4\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{+37}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.46 \cdot 10^{-93}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -3.7 \cdot 10^{-190}:\\
\;\;\;\;4\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-222}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+68}:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -4.0999999999999999e140 or -3.20000000000000003e56 < z < -2.7999999999999998e37 or 9.0000000000000007e68 < z Initial program 99.0%
associate-*l/99.6%
+-commutative99.6%
associate--l+99.6%
distribute-lft-in99.6%
associate-+r+99.6%
*-commutative99.6%
+-commutative99.6%
fma-def99.6%
associate-*r*99.6%
associate-*l/99.7%
associate-/l*99.7%
*-inverses99.7%
metadata-eval99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around 0 90.7%
Taylor expanded in x around 0 74.4%
neg-mul-174.4%
Simplified74.4%
Taylor expanded in z around 0 74.4%
if -4.0999999999999999e140 < z < -3.20000000000000003e56 or -1.45999999999999999e-93 < z < -3.7000000000000002e-190 or 1.89999999999999998e-222 < z < 9.0000000000000007e68Initial program 100.0%
associate-*l/99.8%
+-commutative99.8%
associate--l+99.8%
distribute-lft-in99.8%
associate-+r+99.8%
*-commutative99.8%
+-commutative99.8%
fma-def99.8%
associate-*r*99.8%
associate-*l/99.9%
associate-/l*99.9%
*-inverses99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 59.0%
if -2.7999999999999998e37 < z < -1.45999999999999999e-93 or -3.7000000000000002e-190 < z < 1.89999999999999998e-222Initial program 98.5%
associate-*l/99.8%
+-commutative99.8%
associate--l+99.8%
distribute-lft-in99.7%
associate-+r+99.7%
*-commutative99.7%
+-commutative99.7%
fma-def99.7%
associate-*r*99.7%
associate-*l/98.4%
associate-/l*99.8%
*-inverses99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around 0 62.2%
Taylor expanded in x around inf 56.7%
Final simplification64.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.5e+140) (not (<= z 3.6e+69))) (* 4.0 (/ (- x z) y)) (+ 4.0 (* 4.0 (/ x y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.5e+140) || !(z <= 3.6e+69)) {
tmp = 4.0 * ((x - z) / 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 ((z <= (-2.5d+140)) .or. (.not. (z <= 3.6d+69))) then
tmp = 4.0d0 * ((x - z) / 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 ((z <= -2.5e+140) || !(z <= 3.6e+69)) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.0 + (4.0 * (x / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.5e+140) or not (z <= 3.6e+69): tmp = 4.0 * ((x - z) / y) else: tmp = 4.0 + (4.0 * (x / y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.5e+140) || !(z <= 3.6e+69)) tmp = Float64(4.0 * Float64(Float64(x - z) / y)); else tmp = Float64(4.0 + Float64(4.0 * Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.5e+140) || ~((z <= 3.6e+69))) tmp = 4.0 * ((x - z) / y); else tmp = 4.0 + (4.0 * (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.5e+140], N[Not[LessEqual[z, 3.6e+69]], $MachinePrecision]], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(4.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+140} \lor \neg \left(z \leq 3.6 \cdot 10^{+69}\right):\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + 4 \cdot \frac{x}{y}\\
\end{array}
\end{array}
if z < -2.50000000000000004e140 or 3.6000000000000003e69 < z Initial program 98.9%
associate-*l/99.6%
+-commutative99.6%
associate--l+99.6%
distribute-lft-in99.6%
associate-+r+99.6%
*-commutative99.6%
+-commutative99.6%
fma-def99.6%
associate-*r*99.6%
associate-*l/99.7%
associate-/l*99.7%
*-inverses99.7%
metadata-eval99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around 0 91.1%
if -2.50000000000000004e140 < z < 3.6000000000000003e69Initial program 99.4%
associate-*l/99.8%
+-commutative99.8%
associate--l+99.8%
distribute-lft-in99.8%
associate-+r+99.8%
*-commutative99.8%
+-commutative99.8%
fma-def99.8%
associate-*r*99.8%
associate-*l/99.3%
associate-/l*99.9%
*-inverses99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around 0 87.4%
Final simplification88.7%
(FPCore (x y z) :precision binary64 (if (<= y -9.2e+138) 4.0 (if (<= y 3e+172) (* 4.0 (/ (- x z) y)) 4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -9.2e+138) {
tmp = 4.0;
} else if (y <= 3e+172) {
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 <= (-9.2d+138)) then
tmp = 4.0d0
else if (y <= 3d+172) 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 <= -9.2e+138) {
tmp = 4.0;
} else if (y <= 3e+172) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -9.2e+138: tmp = 4.0 elif y <= 3e+172: tmp = 4.0 * ((x - z) / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -9.2e+138) tmp = 4.0; elseif (y <= 3e+172) 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 <= -9.2e+138) tmp = 4.0; elseif (y <= 3e+172) tmp = 4.0 * ((x - z) / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -9.2e+138], 4.0, If[LessEqual[y, 3e+172], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.2 \cdot 10^{+138}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+172}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -9.2000000000000003e138 or 2.9999999999999999e172 < y Initial program 98.4%
associate-*l/99.6%
+-commutative99.6%
associate--l+99.6%
distribute-lft-in99.6%
associate-+r+99.6%
*-commutative99.6%
+-commutative99.6%
fma-def99.6%
associate-*r*99.7%
associate-*l/98.5%
associate-/l*99.9%
*-inverses99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 80.9%
if -9.2000000000000003e138 < y < 2.9999999999999999e172Initial program 99.5%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
distribute-lft-in99.8%
associate-+r+99.8%
*-commutative99.8%
+-commutative99.8%
fma-def99.8%
associate-*r*99.7%
associate-*l/99.8%
associate-/l*99.8%
*-inverses99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around 0 82.1%
Final simplification81.8%
(FPCore (x y z) :precision binary64 (if (<= z -1.52e+38) (+ 4.0 (* (/ z y) -4.0)) (if (<= z 4.5e+71) (+ 4.0 (* 4.0 (/ x y))) (* 4.0 (/ (- x z) y)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.52e+38) {
tmp = 4.0 + ((z / y) * -4.0);
} else if (z <= 4.5e+71) {
tmp = 4.0 + (4.0 * (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.52d+38)) then
tmp = 4.0d0 + ((z / y) * (-4.0d0))
else if (z <= 4.5d+71) then
tmp = 4.0d0 + (4.0d0 * (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.52e+38) {
tmp = 4.0 + ((z / y) * -4.0);
} else if (z <= 4.5e+71) {
tmp = 4.0 + (4.0 * (x / y));
} else {
tmp = 4.0 * ((x - z) / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.52e+38: tmp = 4.0 + ((z / y) * -4.0) elif z <= 4.5e+71: tmp = 4.0 + (4.0 * (x / y)) else: tmp = 4.0 * ((x - z) / y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.52e+38) tmp = Float64(4.0 + Float64(Float64(z / y) * -4.0)); elseif (z <= 4.5e+71) tmp = Float64(4.0 + Float64(4.0 * 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 (z <= -1.52e+38) tmp = 4.0 + ((z / y) * -4.0); elseif (z <= 4.5e+71) tmp = 4.0 + (4.0 * (x / y)); else tmp = 4.0 * ((x - z) / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.52e+38], N[(4.0 + N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.5e+71], N[(4.0 + N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.52 \cdot 10^{+38}:\\
\;\;\;\;4 + \frac{z}{y} \cdot -4\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+71}:\\
\;\;\;\;4 + 4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\end{array}
\end{array}
if z < -1.51999999999999996e38Initial program 98.0%
associate-*l/99.6%
+-commutative99.6%
associate--l+99.6%
distribute-lft-in99.6%
associate-+r+99.6%
*-commutative99.6%
+-commutative99.6%
fma-def99.7%
associate-*r*99.7%
associate-*l/99.7%
associate-/l*99.7%
*-inverses99.7%
metadata-eval99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around 0 88.0%
*-commutative88.0%
Simplified88.0%
if -1.51999999999999996e38 < z < 4.50000000000000043e71Initial program 99.3%
associate-*l/99.8%
+-commutative99.8%
associate--l+99.8%
distribute-lft-in99.8%
associate-+r+99.8%
*-commutative99.8%
+-commutative99.8%
fma-def99.8%
associate-*r*99.8%
associate-*l/99.2%
associate-/l*99.9%
*-inverses99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around 0 91.0%
if 4.50000000000000043e71 < z Initial program 100.0%
associate-*l/99.6%
+-commutative99.6%
associate--l+99.6%
distribute-lft-in99.6%
associate-+r+99.6%
*-commutative99.6%
+-commutative99.6%
fma-def99.6%
associate-*r*99.6%
associate-*l/99.7%
associate-/l*99.7%
*-inverses99.7%
metadata-eval99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around 0 90.2%
Final simplification90.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.5e+140) (not (<= z 8.4e+68))) (* (/ z y) -4.0) 4.0))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.5e+140) || !(z <= 8.4e+68)) {
tmp = (z / y) * -4.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) :: tmp
if ((z <= (-2.5d+140)) .or. (.not. (z <= 8.4d+68))) then
tmp = (z / y) * (-4.0d0)
else
tmp = 4.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.5e+140) || !(z <= 8.4e+68)) {
tmp = (z / y) * -4.0;
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.5e+140) or not (z <= 8.4e+68): tmp = (z / y) * -4.0 else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.5e+140) || !(z <= 8.4e+68)) tmp = Float64(Float64(z / y) * -4.0); else tmp = 4.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.5e+140) || ~((z <= 8.4e+68))) tmp = (z / y) * -4.0; else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.5e+140], N[Not[LessEqual[z, 8.4e+68]], $MachinePrecision]], N[(N[(z / y), $MachinePrecision] * -4.0), $MachinePrecision], 4.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+140} \lor \neg \left(z \leq 8.4 \cdot 10^{+68}\right):\\
\;\;\;\;\frac{z}{y} \cdot -4\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if z < -2.50000000000000004e140 or 8.40000000000000003e68 < z Initial program 98.9%
associate-*l/99.6%
+-commutative99.6%
associate--l+99.6%
distribute-lft-in99.6%
associate-+r+99.6%
*-commutative99.6%
+-commutative99.6%
fma-def99.6%
associate-*r*99.6%
associate-*l/99.7%
associate-/l*99.7%
*-inverses99.7%
metadata-eval99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around 0 91.1%
Taylor expanded in x around 0 73.7%
neg-mul-173.7%
Simplified73.7%
Taylor expanded in z around 0 73.7%
if -2.50000000000000004e140 < z < 8.40000000000000003e68Initial program 99.4%
associate-*l/99.8%
+-commutative99.8%
associate--l+99.8%
distribute-lft-in99.8%
associate-+r+99.8%
*-commutative99.8%
+-commutative99.8%
fma-def99.8%
associate-*r*99.8%
associate-*l/99.3%
associate-/l*99.9%
*-inverses99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 49.6%
Final simplification57.8%
(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.2%
associate-*l/99.7%
+-commutative99.7%
associate--l+99.7%
distribute-lft-in99.7%
associate-+r+99.7%
*-commutative99.7%
+-commutative99.7%
fma-def99.7%
associate-*r*99.7%
associate-*l/99.4%
associate-/l*99.8%
*-inverses99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 36.3%
Final simplification36.3%
herbie shell --seed 2023230
(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)))