
(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 (- (+ 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}
Initial program 99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* z -4.0) y)) (t_1 (/ (* x 4.0) y)))
(if (<= x -4.7e+97)
t_1
(if (<= x -2.6e-306)
4.0
(if (<= x 1.15e-252)
t_0
(if (<= x 9e-235)
4.0
(if (<= x 1.1e-203) t_0 (if (<= x 5.8e+50) 4.0 t_1))))))))
double code(double x, double y, double z) {
double t_0 = (z * -4.0) / y;
double t_1 = (x * 4.0) / y;
double tmp;
if (x <= -4.7e+97) {
tmp = t_1;
} else if (x <= -2.6e-306) {
tmp = 4.0;
} else if (x <= 1.15e-252) {
tmp = t_0;
} else if (x <= 9e-235) {
tmp = 4.0;
} else if (x <= 1.1e-203) {
tmp = t_0;
} else if (x <= 5.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 = (x * 4.0d0) / y
if (x <= (-4.7d+97)) then
tmp = t_1
else if (x <= (-2.6d-306)) then
tmp = 4.0d0
else if (x <= 1.15d-252) then
tmp = t_0
else if (x <= 9d-235) then
tmp = 4.0d0
else if (x <= 1.1d-203) then
tmp = t_0
else if (x <= 5.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 = (x * 4.0) / y;
double tmp;
if (x <= -4.7e+97) {
tmp = t_1;
} else if (x <= -2.6e-306) {
tmp = 4.0;
} else if (x <= 1.15e-252) {
tmp = t_0;
} else if (x <= 9e-235) {
tmp = 4.0;
} else if (x <= 1.1e-203) {
tmp = t_0;
} else if (x <= 5.8e+50) {
tmp = 4.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = (z * -4.0) / y t_1 = (x * 4.0) / y tmp = 0 if x <= -4.7e+97: tmp = t_1 elif x <= -2.6e-306: tmp = 4.0 elif x <= 1.15e-252: tmp = t_0 elif x <= 9e-235: tmp = 4.0 elif x <= 1.1e-203: tmp = t_0 elif x <= 5.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(Float64(x * 4.0) / y) tmp = 0.0 if (x <= -4.7e+97) tmp = t_1; elseif (x <= -2.6e-306) tmp = 4.0; elseif (x <= 1.15e-252) tmp = t_0; elseif (x <= 9e-235) tmp = 4.0; elseif (x <= 1.1e-203) tmp = t_0; elseif (x <= 5.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 = (x * 4.0) / y; tmp = 0.0; if (x <= -4.7e+97) tmp = t_1; elseif (x <= -2.6e-306) tmp = 4.0; elseif (x <= 1.15e-252) tmp = t_0; elseif (x <= 9e-235) tmp = 4.0; elseif (x <= 1.1e-203) tmp = t_0; elseif (x <= 5.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[(N[(x * 4.0), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[x, -4.7e+97], t$95$1, If[LessEqual[x, -2.6e-306], 4.0, If[LessEqual[x, 1.15e-252], t$95$0, If[LessEqual[x, 9e-235], 4.0, If[LessEqual[x, 1.1e-203], t$95$0, If[LessEqual[x, 5.8e+50], 4.0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z \cdot -4}{y}\\
t_1 := \frac{x \cdot 4}{y}\\
\mathbf{if}\;x \leq -4.7 \cdot 10^{+97}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.6 \cdot 10^{-306}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-252}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-235}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-203}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{+50}:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4.6999999999999997e97 or 5.8e50 < x Initial program 99.9%
Taylor expanded in x around inf 0
Simplified0
if -4.6999999999999997e97 < x < -2.6e-306 or 1.1499999999999999e-252 < x < 8.9999999999999996e-235 or 1.1e-203 < x < 5.8e50Initial program 99.9%
Taylor expanded in y around inf 0
Simplified0
if -2.6e-306 < x < 1.1499999999999999e-252 or 8.9999999999999996e-235 < x < 1.1e-203Initial program 100.0%
Taylor expanded in z around inf 0
Simplified0
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ -4.0 y) z)) (t_1 (/ (* x 4.0) y)))
(if (<= x -2.6e+96)
t_1
(if (<= x 3.5e-304)
4.0
(if (<= x 1.6e-252)
t_0
(if (<= x 2e-234)
4.0
(if (<= x 7e-203) t_0 (if (<= x 1.08e+51) 4.0 t_1))))))))
double code(double x, double y, double z) {
double t_0 = (-4.0 / y) * z;
double t_1 = (x * 4.0) / y;
double tmp;
if (x <= -2.6e+96) {
tmp = t_1;
} else if (x <= 3.5e-304) {
tmp = 4.0;
} else if (x <= 1.6e-252) {
tmp = t_0;
} else if (x <= 2e-234) {
tmp = 4.0;
} else if (x <= 7e-203) {
tmp = t_0;
} else if (x <= 1.08e+51) {
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) / y) * z
t_1 = (x * 4.0d0) / y
if (x <= (-2.6d+96)) then
tmp = t_1
else if (x <= 3.5d-304) then
tmp = 4.0d0
else if (x <= 1.6d-252) then
tmp = t_0
else if (x <= 2d-234) then
tmp = 4.0d0
else if (x <= 7d-203) then
tmp = t_0
else if (x <= 1.08d+51) 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 / y) * z;
double t_1 = (x * 4.0) / y;
double tmp;
if (x <= -2.6e+96) {
tmp = t_1;
} else if (x <= 3.5e-304) {
tmp = 4.0;
} else if (x <= 1.6e-252) {
tmp = t_0;
} else if (x <= 2e-234) {
tmp = 4.0;
} else if (x <= 7e-203) {
tmp = t_0;
} else if (x <= 1.08e+51) {
tmp = 4.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = (-4.0 / y) * z t_1 = (x * 4.0) / y tmp = 0 if x <= -2.6e+96: tmp = t_1 elif x <= 3.5e-304: tmp = 4.0 elif x <= 1.6e-252: tmp = t_0 elif x <= 2e-234: tmp = 4.0 elif x <= 7e-203: tmp = t_0 elif x <= 1.08e+51: tmp = 4.0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(Float64(-4.0 / y) * z) t_1 = Float64(Float64(x * 4.0) / y) tmp = 0.0 if (x <= -2.6e+96) tmp = t_1; elseif (x <= 3.5e-304) tmp = 4.0; elseif (x <= 1.6e-252) tmp = t_0; elseif (x <= 2e-234) tmp = 4.0; elseif (x <= 7e-203) tmp = t_0; elseif (x <= 1.08e+51) tmp = 4.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (-4.0 / y) * z; t_1 = (x * 4.0) / y; tmp = 0.0; if (x <= -2.6e+96) tmp = t_1; elseif (x <= 3.5e-304) tmp = 4.0; elseif (x <= 1.6e-252) tmp = t_0; elseif (x <= 2e-234) tmp = 4.0; elseif (x <= 7e-203) tmp = t_0; elseif (x <= 1.08e+51) tmp = 4.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(-4.0 / y), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * 4.0), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[x, -2.6e+96], t$95$1, If[LessEqual[x, 3.5e-304], 4.0, If[LessEqual[x, 1.6e-252], t$95$0, If[LessEqual[x, 2e-234], 4.0, If[LessEqual[x, 7e-203], t$95$0, If[LessEqual[x, 1.08e+51], 4.0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-4}{y} \cdot z\\
t_1 := \frac{x \cdot 4}{y}\\
\mathbf{if}\;x \leq -2.6 \cdot 10^{+96}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-304}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-252}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-234}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-203}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.08 \cdot 10^{+51}:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.6e96 or 1.08e51 < x Initial program 99.9%
Taylor expanded in x around inf 0
Simplified0
if -2.6e96 < x < 3.5e-304 or 1.6000000000000001e-252 < x < 1.9999999999999999e-234 or 7.0000000000000003e-203 < x < 1.08e51Initial program 99.9%
Taylor expanded in y around inf 0
Simplified0
if 3.5e-304 < x < 1.6000000000000001e-252 or 1.9999999999999999e-234 < x < 7.0000000000000003e-203Initial program 100.0%
Taylor expanded in z around inf 0
Simplified0
Applied egg-rr0
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (/ -4.0 y) z)) (t_1 (* (/ 4.0 y) x)))
(if (<= x -9e+94)
t_1
(if (<= x -2.7e-304)
4.0
(if (<= x 2.2e-251)
t_0
(if (<= x 2.2e-234)
4.0
(if (<= x 3.7e-204) t_0 (if (<= x 5.4e+50) 4.0 t_1))))))))
double code(double x, double y, double z) {
double t_0 = (-4.0 / y) * z;
double t_1 = (4.0 / y) * x;
double tmp;
if (x <= -9e+94) {
tmp = t_1;
} else if (x <= -2.7e-304) {
tmp = 4.0;
} else if (x <= 2.2e-251) {
tmp = t_0;
} else if (x <= 2.2e-234) {
tmp = 4.0;
} else if (x <= 3.7e-204) {
tmp = t_0;
} else if (x <= 5.4e+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 = ((-4.0d0) / y) * z
t_1 = (4.0d0 / y) * x
if (x <= (-9d+94)) then
tmp = t_1
else if (x <= (-2.7d-304)) then
tmp = 4.0d0
else if (x <= 2.2d-251) then
tmp = t_0
else if (x <= 2.2d-234) then
tmp = 4.0d0
else if (x <= 3.7d-204) then
tmp = t_0
else if (x <= 5.4d+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 = (-4.0 / y) * z;
double t_1 = (4.0 / y) * x;
double tmp;
if (x <= -9e+94) {
tmp = t_1;
} else if (x <= -2.7e-304) {
tmp = 4.0;
} else if (x <= 2.2e-251) {
tmp = t_0;
} else if (x <= 2.2e-234) {
tmp = 4.0;
} else if (x <= 3.7e-204) {
tmp = t_0;
} else if (x <= 5.4e+50) {
tmp = 4.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = (-4.0 / y) * z t_1 = (4.0 / y) * x tmp = 0 if x <= -9e+94: tmp = t_1 elif x <= -2.7e-304: tmp = 4.0 elif x <= 2.2e-251: tmp = t_0 elif x <= 2.2e-234: tmp = 4.0 elif x <= 3.7e-204: tmp = t_0 elif x <= 5.4e+50: tmp = 4.0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(Float64(-4.0 / y) * z) t_1 = Float64(Float64(4.0 / y) * x) tmp = 0.0 if (x <= -9e+94) tmp = t_1; elseif (x <= -2.7e-304) tmp = 4.0; elseif (x <= 2.2e-251) tmp = t_0; elseif (x <= 2.2e-234) tmp = 4.0; elseif (x <= 3.7e-204) tmp = t_0; elseif (x <= 5.4e+50) tmp = 4.0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (-4.0 / y) * z; t_1 = (4.0 / y) * x; tmp = 0.0; if (x <= -9e+94) tmp = t_1; elseif (x <= -2.7e-304) tmp = 4.0; elseif (x <= 2.2e-251) tmp = t_0; elseif (x <= 2.2e-234) tmp = 4.0; elseif (x <= 3.7e-204) tmp = t_0; elseif (x <= 5.4e+50) tmp = 4.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(-4.0 / y), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 / y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -9e+94], t$95$1, If[LessEqual[x, -2.7e-304], 4.0, If[LessEqual[x, 2.2e-251], t$95$0, If[LessEqual[x, 2.2e-234], 4.0, If[LessEqual[x, 3.7e-204], t$95$0, If[LessEqual[x, 5.4e+50], 4.0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-4}{y} \cdot z\\
t_1 := \frac{4}{y} \cdot x\\
\mathbf{if}\;x \leq -9 \cdot 10^{+94}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.7 \cdot 10^{-304}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-251}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-234}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{-204}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.4 \cdot 10^{+50}:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -8.99999999999999944e94 or 5.4e50 < x Initial program 99.9%
Taylor expanded in x around inf 0
Simplified0
Applied egg-rr0
if -8.99999999999999944e94 < x < -2.7000000000000001e-304 or 2.2e-251 < x < 2.1999999999999999e-234 or 3.6999999999999997e-204 < x < 5.4e50Initial program 99.9%
Taylor expanded in y around inf 0
Simplified0
if -2.7000000000000001e-304 < x < 2.2e-251 or 2.1999999999999999e-234 < x < 3.6999999999999997e-204Initial program 100.0%
Taylor expanded in z around inf 0
Simplified0
Applied egg-rr0
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (* 4.0 (- x z)) y))) (if (<= x -4.6e+94) t_0 (if (<= x 6.5e+50) (+ 4.0 (/ (* z -4.0) y)) t_0))))
double code(double x, double y, double z) {
double t_0 = (4.0 * (x - z)) / y;
double tmp;
if (x <= -4.6e+94) {
tmp = t_0;
} else if (x <= 6.5e+50) {
tmp = 4.0 + ((z * -4.0) / y);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (4.0d0 * (x - z)) / y
if (x <= (-4.6d+94)) then
tmp = t_0
else if (x <= 6.5d+50) then
tmp = 4.0d0 + ((z * (-4.0d0)) / y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (4.0 * (x - z)) / y;
double tmp;
if (x <= -4.6e+94) {
tmp = t_0;
} else if (x <= 6.5e+50) {
tmp = 4.0 + ((z * -4.0) / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (4.0 * (x - z)) / y tmp = 0 if x <= -4.6e+94: tmp = t_0 elif x <= 6.5e+50: tmp = 4.0 + ((z * -4.0) / y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(4.0 * Float64(x - z)) / y) tmp = 0.0 if (x <= -4.6e+94) tmp = t_0; elseif (x <= 6.5e+50) tmp = Float64(4.0 + Float64(Float64(z * -4.0) / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (4.0 * (x - z)) / y; tmp = 0.0; if (x <= -4.6e+94) tmp = t_0; elseif (x <= 6.5e+50) tmp = 4.0 + ((z * -4.0) / y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(4.0 * N[(x - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[x, -4.6e+94], t$95$0, If[LessEqual[x, 6.5e+50], N[(4.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{4 \cdot \left(x - z\right)}{y}\\
\mathbf{if}\;x \leq -4.6 \cdot 10^{+94}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+50}:\\
\;\;\;\;4 + \frac{z \cdot -4}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -4.5999999999999999e94 or 6.5000000000000003e50 < x Initial program 99.9%
Taylor expanded in y around 0 0
Simplified0
if -4.5999999999999999e94 < x < 6.5000000000000003e50Initial program 99.9%
Taylor expanded in x around 0 0
Simplified0
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ 4.0 (/ (* z -4.0) y)))) (if (<= z -1e-26) t_0 (if (<= z 2200.0) (+ 4.0 (/ (* x 4.0) y)) t_0))))
double code(double x, double y, double z) {
double t_0 = 4.0 + ((z * -4.0) / y);
double tmp;
if (z <= -1e-26) {
tmp = t_0;
} else if (z <= 2200.0) {
tmp = 4.0 + ((x * 4.0) / y);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = 4.0d0 + ((z * (-4.0d0)) / y)
if (z <= (-1d-26)) then
tmp = t_0
else if (z <= 2200.0d0) then
tmp = 4.0d0 + ((x * 4.0d0) / y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 4.0 + ((z * -4.0) / y);
double tmp;
if (z <= -1e-26) {
tmp = t_0;
} else if (z <= 2200.0) {
tmp = 4.0 + ((x * 4.0) / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 4.0 + ((z * -4.0) / y) tmp = 0 if z <= -1e-26: tmp = t_0 elif z <= 2200.0: tmp = 4.0 + ((x * 4.0) / y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(4.0 + Float64(Float64(z * -4.0) / y)) tmp = 0.0 if (z <= -1e-26) tmp = t_0; elseif (z <= 2200.0) tmp = Float64(4.0 + Float64(Float64(x * 4.0) / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 4.0 + ((z * -4.0) / y); tmp = 0.0; if (z <= -1e-26) tmp = t_0; elseif (z <= 2200.0) tmp = 4.0 + ((x * 4.0) / y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 + N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1e-26], t$95$0, If[LessEqual[z, 2200.0], N[(4.0 + N[(N[(x * 4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 4 + \frac{z \cdot -4}{y}\\
\mathbf{if}\;z \leq -1 \cdot 10^{-26}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2200:\\
\;\;\;\;4 + \frac{x \cdot 4}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1e-26 or 2200 < z Initial program 100.0%
Taylor expanded in x around 0 0
Simplified0
if -1e-26 < z < 2200Initial program 99.9%
Simplified0
Taylor expanded in x around inf 0
Simplified0
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (* z -4.0) y))) (if (<= z -9e+150) t_0 (if (<= z 6e+195) (+ 4.0 (/ (* x 4.0) y)) t_0))))
double code(double x, double y, double z) {
double t_0 = (z * -4.0) / y;
double tmp;
if (z <= -9e+150) {
tmp = t_0;
} else if (z <= 6e+195) {
tmp = 4.0 + ((x * 4.0) / y);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (z * (-4.0d0)) / y
if (z <= (-9d+150)) then
tmp = t_0
else if (z <= 6d+195) then
tmp = 4.0d0 + ((x * 4.0d0) / y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (z * -4.0) / y;
double tmp;
if (z <= -9e+150) {
tmp = t_0;
} else if (z <= 6e+195) {
tmp = 4.0 + ((x * 4.0) / y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (z * -4.0) / y tmp = 0 if z <= -9e+150: tmp = t_0 elif z <= 6e+195: tmp = 4.0 + ((x * 4.0) / y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(z * -4.0) / y) tmp = 0.0 if (z <= -9e+150) tmp = t_0; elseif (z <= 6e+195) tmp = Float64(4.0 + Float64(Float64(x * 4.0) / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (z * -4.0) / y; tmp = 0.0; if (z <= -9e+150) tmp = t_0; elseif (z <= 6e+195) tmp = 4.0 + ((x * 4.0) / y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(z * -4.0), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[z, -9e+150], t$95$0, If[LessEqual[z, 6e+195], N[(4.0 + N[(N[(x * 4.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{z \cdot -4}{y}\\
\mathbf{if}\;z \leq -9 \cdot 10^{+150}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+195}:\\
\;\;\;\;4 + \frac{x \cdot 4}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -9.00000000000000001e150 or 6.0000000000000001e195 < z Initial program 100.0%
Taylor expanded in z around inf 0
Simplified0
if -9.00000000000000001e150 < z < 6.0000000000000001e195Initial program 99.9%
Simplified0
Taylor expanded in x around inf 0
Simplified0
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (/ -4.0 y) z))) (if (<= z -1.35e+70) t_0 (if (<= z 6.6e+74) 4.0 t_0))))
double code(double x, double y, double z) {
double t_0 = (-4.0 / y) * z;
double tmp;
if (z <= -1.35e+70) {
tmp = t_0;
} else if (z <= 6.6e+74) {
tmp = 4.0;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((-4.0d0) / y) * z
if (z <= (-1.35d+70)) then
tmp = t_0
else if (z <= 6.6d+74) then
tmp = 4.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (-4.0 / y) * z;
double tmp;
if (z <= -1.35e+70) {
tmp = t_0;
} else if (z <= 6.6e+74) {
tmp = 4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (-4.0 / y) * z tmp = 0 if z <= -1.35e+70: tmp = t_0 elif z <= 6.6e+74: tmp = 4.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(-4.0 / y) * z) tmp = 0.0 if (z <= -1.35e+70) tmp = t_0; elseif (z <= 6.6e+74) tmp = 4.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (-4.0 / y) * z; tmp = 0.0; if (z <= -1.35e+70) tmp = t_0; elseif (z <= 6.6e+74) tmp = 4.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(-4.0 / y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -1.35e+70], t$95$0, If[LessEqual[z, 6.6e+74], 4.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-4}{y} \cdot z\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{+70}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{+74}:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.35e70 or 6.6000000000000004e74 < z Initial program 100.0%
Taylor expanded in z around inf 0
Simplified0
Applied egg-rr0
if -1.35e70 < z < 6.6000000000000004e74Initial program 99.9%
Taylor expanded in y around inf 0
Simplified0
(FPCore (x y z) :precision binary64 (+ 4.0 (* (- x z) (/ 4.0 y))))
double code(double x, double y, double z) {
return 4.0 + ((x - z) * (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 = 4.0d0 + ((x - z) * (4.0d0 / y))
end function
public static double code(double x, double y, double z) {
return 4.0 + ((x - z) * (4.0 / y));
}
def code(x, y, z): return 4.0 + ((x - z) * (4.0 / y))
function code(x, y, z) return Float64(4.0 + Float64(Float64(x - z) * Float64(4.0 / y))) end
function tmp = code(x, y, z) tmp = 4.0 + ((x - z) * (4.0 / y)); end
code[x_, y_, z_] := N[(4.0 + N[(N[(x - z), $MachinePrecision] * N[(4.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
4 + \left(x - z\right) \cdot \frac{4}{y}
\end{array}
Initial program 99.9%
Simplified0
(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 0
Simplified0
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)))