
(FPCore (x y z) :precision binary64 (/ (* 4.0 (- (- x y) (* z 0.5))) z))
double code(double x, double y, double z) {
return (4.0 * ((x - y) - (z * 0.5))) / z;
}
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 - y) - (z * 0.5d0))) / z
end function
public static double code(double x, double y, double z) {
return (4.0 * ((x - y) - (z * 0.5))) / z;
}
def code(x, y, z): return (4.0 * ((x - y) - (z * 0.5))) / z
function code(x, y, z) return Float64(Float64(4.0 * Float64(Float64(x - y) - Float64(z * 0.5))) / z) end
function tmp = code(x, y, z) tmp = (4.0 * ((x - y) - (z * 0.5))) / z; end
code[x_, y_, z_] := N[(N[(4.0 * N[(N[(x - y), $MachinePrecision] - N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* 4.0 (- (- x y) (* z 0.5))) z))
double code(double x, double y, double z) {
return (4.0 * ((x - y) - (z * 0.5))) / z;
}
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 - y) - (z * 0.5d0))) / z
end function
public static double code(double x, double y, double z) {
return (4.0 * ((x - y) - (z * 0.5))) / z;
}
def code(x, y, z): return (4.0 * ((x - y) - (z * 0.5))) / z
function code(x, y, z) return Float64(Float64(4.0 * Float64(Float64(x - y) - Float64(z * 0.5))) / z) end
function tmp = code(x, y, z) tmp = (4.0 * ((x - y) - (z * 0.5))) / z; end
code[x_, y_, z_] := N[(N[(4.0 * N[(N[(x - y), $MachinePrecision] - N[(z * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{4 \cdot \left(\left(x - y\right) - z \cdot 0.5\right)}{z}
\end{array}
(FPCore (x y z) :precision binary64 (+ -2.0 (/ (* 4.0 (- x y)) z)))
double code(double x, double y, double z) {
return -2.0 + ((4.0 * (x - y)) / z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (-2.0d0) + ((4.0d0 * (x - y)) / z)
end function
public static double code(double x, double y, double z) {
return -2.0 + ((4.0 * (x - y)) / z);
}
def code(x, y, z): return -2.0 + ((4.0 * (x - y)) / z)
function code(x, y, z) return Float64(-2.0 + Float64(Float64(4.0 * Float64(x - y)) / z)) end
function tmp = code(x, y, z) tmp = -2.0 + ((4.0 * (x - y)) / z); end
code[x_, y_, z_] := N[(-2.0 + N[(N[(4.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-2 + \frac{4 \cdot \left(x - y\right)}{z}
\end{array}
Initial program 100.0%
Simplified0
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* -4.0 y) z)) (t_1 (/ (* 4.0 x) z)))
(if (<= x -1.1e+91)
t_1
(if (<= x -3.7e-46)
-2.0
(if (<= x -1.75e-158)
t_0
(if (<= x 3.5e-286) -2.0 (if (<= x 1.08e+124) t_0 t_1)))))))
double code(double x, double y, double z) {
double t_0 = (-4.0 * y) / z;
double t_1 = (4.0 * x) / z;
double tmp;
if (x <= -1.1e+91) {
tmp = t_1;
} else if (x <= -3.7e-46) {
tmp = -2.0;
} else if (x <= -1.75e-158) {
tmp = t_0;
} else if (x <= 3.5e-286) {
tmp = -2.0;
} else if (x <= 1.08e+124) {
tmp = t_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 * x) / z
if (x <= (-1.1d+91)) then
tmp = t_1
else if (x <= (-3.7d-46)) then
tmp = -2.0d0
else if (x <= (-1.75d-158)) then
tmp = t_0
else if (x <= 3.5d-286) then
tmp = -2.0d0
else if (x <= 1.08d+124) then
tmp = t_0
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 * x) / z;
double tmp;
if (x <= -1.1e+91) {
tmp = t_1;
} else if (x <= -3.7e-46) {
tmp = -2.0;
} else if (x <= -1.75e-158) {
tmp = t_0;
} else if (x <= 3.5e-286) {
tmp = -2.0;
} else if (x <= 1.08e+124) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = (-4.0 * y) / z t_1 = (4.0 * x) / z tmp = 0 if x <= -1.1e+91: tmp = t_1 elif x <= -3.7e-46: tmp = -2.0 elif x <= -1.75e-158: tmp = t_0 elif x <= 3.5e-286: tmp = -2.0 elif x <= 1.08e+124: tmp = t_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 * x) / z) tmp = 0.0 if (x <= -1.1e+91) tmp = t_1; elseif (x <= -3.7e-46) tmp = -2.0; elseif (x <= -1.75e-158) tmp = t_0; elseif (x <= 3.5e-286) tmp = -2.0; elseif (x <= 1.08e+124) tmp = t_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 * x) / z; tmp = 0.0; if (x <= -1.1e+91) tmp = t_1; elseif (x <= -3.7e-46) tmp = -2.0; elseif (x <= -1.75e-158) tmp = t_0; elseif (x <= 3.5e-286) tmp = -2.0; elseif (x <= 1.08e+124) tmp = t_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 * x), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[x, -1.1e+91], t$95$1, If[LessEqual[x, -3.7e-46], -2.0, If[LessEqual[x, -1.75e-158], t$95$0, If[LessEqual[x, 3.5e-286], -2.0, If[LessEqual[x, 1.08e+124], t$95$0, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-4 \cdot y}{z}\\
t_1 := \frac{4 \cdot x}{z}\\
\mathbf{if}\;x \leq -1.1 \cdot 10^{+91}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{-46}:\\
\;\;\;\;-2\\
\mathbf{elif}\;x \leq -1.75 \cdot 10^{-158}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-286}:\\
\;\;\;\;-2\\
\mathbf{elif}\;x \leq 1.08 \cdot 10^{+124}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.1e91 or 1.08000000000000005e124 < x Initial program 100.0%
Simplified0
Taylor expanded in x around inf 0
Simplified0
if -1.1e91 < x < -3.69999999999999983e-46 or -1.75000000000000006e-158 < x < 3.49999999999999988e-286Initial program 100.0%
Simplified0
Taylor expanded in z around inf 0
Simplified0
if -3.69999999999999983e-46 < x < -1.75000000000000006e-158 or 3.49999999999999988e-286 < x < 1.08000000000000005e124Initial program 100.0%
Simplified0
Taylor expanded in y around inf 0
Simplified0
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* -4.0 y) z)) (t_1 (/ 4.0 (/ z x))))
(if (<= x -8.5e+90)
t_1
(if (<= x -1.9e-46)
-2.0
(if (<= x -4.5e-158)
t_0
(if (<= x 1.3e-286) -2.0 (if (<= x 1.08e+124) t_0 t_1)))))))
double code(double x, double y, double z) {
double t_0 = (-4.0 * y) / z;
double t_1 = 4.0 / (z / x);
double tmp;
if (x <= -8.5e+90) {
tmp = t_1;
} else if (x <= -1.9e-46) {
tmp = -2.0;
} else if (x <= -4.5e-158) {
tmp = t_0;
} else if (x <= 1.3e-286) {
tmp = -2.0;
} else if (x <= 1.08e+124) {
tmp = t_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 / (z / x)
if (x <= (-8.5d+90)) then
tmp = t_1
else if (x <= (-1.9d-46)) then
tmp = -2.0d0
else if (x <= (-4.5d-158)) then
tmp = t_0
else if (x <= 1.3d-286) then
tmp = -2.0d0
else if (x <= 1.08d+124) then
tmp = t_0
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 / (z / x);
double tmp;
if (x <= -8.5e+90) {
tmp = t_1;
} else if (x <= -1.9e-46) {
tmp = -2.0;
} else if (x <= -4.5e-158) {
tmp = t_0;
} else if (x <= 1.3e-286) {
tmp = -2.0;
} else if (x <= 1.08e+124) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = (-4.0 * y) / z t_1 = 4.0 / (z / x) tmp = 0 if x <= -8.5e+90: tmp = t_1 elif x <= -1.9e-46: tmp = -2.0 elif x <= -4.5e-158: tmp = t_0 elif x <= 1.3e-286: tmp = -2.0 elif x <= 1.08e+124: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(Float64(-4.0 * y) / z) t_1 = Float64(4.0 / Float64(z / x)) tmp = 0.0 if (x <= -8.5e+90) tmp = t_1; elseif (x <= -1.9e-46) tmp = -2.0; elseif (x <= -4.5e-158) tmp = t_0; elseif (x <= 1.3e-286) tmp = -2.0; elseif (x <= 1.08e+124) tmp = t_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 / (z / x); tmp = 0.0; if (x <= -8.5e+90) tmp = t_1; elseif (x <= -1.9e-46) tmp = -2.0; elseif (x <= -4.5e-158) tmp = t_0; elseif (x <= 1.3e-286) tmp = -2.0; elseif (x <= 1.08e+124) tmp = t_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[(4.0 / N[(z / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -8.5e+90], t$95$1, If[LessEqual[x, -1.9e-46], -2.0, If[LessEqual[x, -4.5e-158], t$95$0, If[LessEqual[x, 1.3e-286], -2.0, If[LessEqual[x, 1.08e+124], t$95$0, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-4 \cdot y}{z}\\
t_1 := \frac{4}{\frac{z}{x}}\\
\mathbf{if}\;x \leq -8.5 \cdot 10^{+90}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.9 \cdot 10^{-46}:\\
\;\;\;\;-2\\
\mathbf{elif}\;x \leq -4.5 \cdot 10^{-158}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-286}:\\
\;\;\;\;-2\\
\mathbf{elif}\;x \leq 1.08 \cdot 10^{+124}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -8.5000000000000002e90 or 1.08000000000000005e124 < x Initial program 100.0%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Applied egg-rr0
if -8.5000000000000002e90 < x < -1.8999999999999998e-46 or -4.5e-158 < x < 1.3e-286Initial program 100.0%
Simplified0
Taylor expanded in z around inf 0
Simplified0
if -1.8999999999999998e-46 < x < -4.5e-158 or 1.3e-286 < x < 1.08000000000000005e124Initial program 100.0%
Simplified0
Taylor expanded in y around inf 0
Simplified0
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ -4.0 (/ z y))) (t_1 (/ 4.0 (/ z x))))
(if (<= x -1.5e+91)
t_1
(if (<= x -1.12e-44)
-2.0
(if (<= x -2.4e-156)
t_0
(if (<= x 7.5e-287) -2.0 (if (<= x 1.08e+124) t_0 t_1)))))))
double code(double x, double y, double z) {
double t_0 = -4.0 / (z / y);
double t_1 = 4.0 / (z / x);
double tmp;
if (x <= -1.5e+91) {
tmp = t_1;
} else if (x <= -1.12e-44) {
tmp = -2.0;
} else if (x <= -2.4e-156) {
tmp = t_0;
} else if (x <= 7.5e-287) {
tmp = -2.0;
} else if (x <= 1.08e+124) {
tmp = t_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) / (z / y)
t_1 = 4.0d0 / (z / x)
if (x <= (-1.5d+91)) then
tmp = t_1
else if (x <= (-1.12d-44)) then
tmp = -2.0d0
else if (x <= (-2.4d-156)) then
tmp = t_0
else if (x <= 7.5d-287) then
tmp = -2.0d0
else if (x <= 1.08d+124) then
tmp = t_0
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 / (z / y);
double t_1 = 4.0 / (z / x);
double tmp;
if (x <= -1.5e+91) {
tmp = t_1;
} else if (x <= -1.12e-44) {
tmp = -2.0;
} else if (x <= -2.4e-156) {
tmp = t_0;
} else if (x <= 7.5e-287) {
tmp = -2.0;
} else if (x <= 1.08e+124) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = -4.0 / (z / y) t_1 = 4.0 / (z / x) tmp = 0 if x <= -1.5e+91: tmp = t_1 elif x <= -1.12e-44: tmp = -2.0 elif x <= -2.4e-156: tmp = t_0 elif x <= 7.5e-287: tmp = -2.0 elif x <= 1.08e+124: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(-4.0 / Float64(z / y)) t_1 = Float64(4.0 / Float64(z / x)) tmp = 0.0 if (x <= -1.5e+91) tmp = t_1; elseif (x <= -1.12e-44) tmp = -2.0; elseif (x <= -2.4e-156) tmp = t_0; elseif (x <= 7.5e-287) tmp = -2.0; elseif (x <= 1.08e+124) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -4.0 / (z / y); t_1 = 4.0 / (z / x); tmp = 0.0; if (x <= -1.5e+91) tmp = t_1; elseif (x <= -1.12e-44) tmp = -2.0; elseif (x <= -2.4e-156) tmp = t_0; elseif (x <= 7.5e-287) tmp = -2.0; elseif (x <= 1.08e+124) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-4.0 / N[(z / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(4.0 / N[(z / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.5e+91], t$95$1, If[LessEqual[x, -1.12e-44], -2.0, If[LessEqual[x, -2.4e-156], t$95$0, If[LessEqual[x, 7.5e-287], -2.0, If[LessEqual[x, 1.08e+124], t$95$0, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-4}{\frac{z}{y}}\\
t_1 := \frac{4}{\frac{z}{x}}\\
\mathbf{if}\;x \leq -1.5 \cdot 10^{+91}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.12 \cdot 10^{-44}:\\
\;\;\;\;-2\\
\mathbf{elif}\;x \leq -2.4 \cdot 10^{-156}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-287}:\\
\;\;\;\;-2\\
\mathbf{elif}\;x \leq 1.08 \cdot 10^{+124}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.50000000000000003e91 or 1.08000000000000005e124 < x Initial program 100.0%
Simplified0
Taylor expanded in x around inf 0
Simplified0
Applied egg-rr0
if -1.50000000000000003e91 < x < -1.1200000000000001e-44 or -2.4e-156 < x < 7.5000000000000001e-287Initial program 100.0%
Simplified0
Taylor expanded in z around inf 0
Simplified0
if -1.1200000000000001e-44 < x < -2.4e-156 or 7.5000000000000001e-287 < x < 1.08000000000000005e124Initial program 100.0%
Simplified0
Taylor expanded in y around inf 0
Simplified0
Applied egg-rr0
(FPCore (x y z) :precision binary64 (if (<= y -6e-82) (/ (* 4.0 (- x y)) z) (if (<= y 0.135) (+ (/ (* 4.0 x) z) -2.0) (+ -2.0 (/ (* -4.0 y) z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -6e-82) {
tmp = (4.0 * (x - y)) / z;
} else if (y <= 0.135) {
tmp = ((4.0 * x) / z) + -2.0;
} else {
tmp = -2.0 + ((-4.0 * y) / z);
}
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 <= (-6d-82)) then
tmp = (4.0d0 * (x - y)) / z
else if (y <= 0.135d0) then
tmp = ((4.0d0 * x) / z) + (-2.0d0)
else
tmp = (-2.0d0) + (((-4.0d0) * y) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -6e-82) {
tmp = (4.0 * (x - y)) / z;
} else if (y <= 0.135) {
tmp = ((4.0 * x) / z) + -2.0;
} else {
tmp = -2.0 + ((-4.0 * y) / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6e-82: tmp = (4.0 * (x - y)) / z elif y <= 0.135: tmp = ((4.0 * x) / z) + -2.0 else: tmp = -2.0 + ((-4.0 * y) / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6e-82) tmp = Float64(Float64(4.0 * Float64(x - y)) / z); elseif (y <= 0.135) tmp = Float64(Float64(Float64(4.0 * x) / z) + -2.0); else tmp = Float64(-2.0 + Float64(Float64(-4.0 * y) / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -6e-82) tmp = (4.0 * (x - y)) / z; elseif (y <= 0.135) tmp = ((4.0 * x) / z) + -2.0; else tmp = -2.0 + ((-4.0 * y) / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6e-82], N[(N[(4.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 0.135], N[(N[(N[(4.0 * x), $MachinePrecision] / z), $MachinePrecision] + -2.0), $MachinePrecision], N[(-2.0 + N[(N[(-4.0 * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{-82}:\\
\;\;\;\;\frac{4 \cdot \left(x - y\right)}{z}\\
\mathbf{elif}\;y \leq 0.135:\\
\;\;\;\;\frac{4 \cdot x}{z} + -2\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{-4 \cdot y}{z}\\
\end{array}
\end{array}
if y < -5.9999999999999998e-82Initial program 100.0%
Taylor expanded in z around 0 0
Simplified0
if -5.9999999999999998e-82 < y < 0.13500000000000001Initial program 100.0%
Simplified0
Taylor expanded in y around 0 0
Simplified0
if 0.13500000000000001 < y Initial program 99.9%
Simplified0
Taylor expanded in x around 0 0
Simplified0
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ -2.0 (/ (* -4.0 y) z)))) (if (<= y -1.2e+76) t_0 (if (<= y 1.3e-6) (+ (/ (* 4.0 x) z) -2.0) t_0))))
double code(double x, double y, double z) {
double t_0 = -2.0 + ((-4.0 * y) / z);
double tmp;
if (y <= -1.2e+76) {
tmp = t_0;
} else if (y <= 1.3e-6) {
tmp = ((4.0 * x) / z) + -2.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 = (-2.0d0) + (((-4.0d0) * y) / z)
if (y <= (-1.2d+76)) then
tmp = t_0
else if (y <= 1.3d-6) then
tmp = ((4.0d0 * x) / z) + (-2.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -2.0 + ((-4.0 * y) / z);
double tmp;
if (y <= -1.2e+76) {
tmp = t_0;
} else if (y <= 1.3e-6) {
tmp = ((4.0 * x) / z) + -2.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -2.0 + ((-4.0 * y) / z) tmp = 0 if y <= -1.2e+76: tmp = t_0 elif y <= 1.3e-6: tmp = ((4.0 * x) / z) + -2.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-2.0 + Float64(Float64(-4.0 * y) / z)) tmp = 0.0 if (y <= -1.2e+76) tmp = t_0; elseif (y <= 1.3e-6) tmp = Float64(Float64(Float64(4.0 * x) / z) + -2.0); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -2.0 + ((-4.0 * y) / z); tmp = 0.0; if (y <= -1.2e+76) tmp = t_0; elseif (y <= 1.3e-6) tmp = ((4.0 * x) / z) + -2.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-2.0 + N[(N[(-4.0 * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.2e+76], t$95$0, If[LessEqual[y, 1.3e-6], N[(N[(N[(4.0 * x), $MachinePrecision] / z), $MachinePrecision] + -2.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -2 + \frac{-4 \cdot y}{z}\\
\mathbf{if}\;y \leq -1.2 \cdot 10^{+76}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{-6}:\\
\;\;\;\;\frac{4 \cdot x}{z} + -2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -1.2e76 or 1.30000000000000005e-6 < y Initial program 99.9%
Simplified0
Taylor expanded in x around 0 0
Simplified0
if -1.2e76 < y < 1.30000000000000005e-6Initial program 100.0%
Simplified0
Taylor expanded in y around 0 0
Simplified0
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* 4.0 x) z)))
(if (<= x -2.2e+109)
t_0
(if (<= x 1.3e+164) (+ -2.0 (/ (* -4.0 y) z)) t_0))))
double code(double x, double y, double z) {
double t_0 = (4.0 * x) / z;
double tmp;
if (x <= -2.2e+109) {
tmp = t_0;
} else if (x <= 1.3e+164) {
tmp = -2.0 + ((-4.0 * y) / z);
} 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
if (x <= (-2.2d+109)) then
tmp = t_0
else if (x <= 1.3d+164) then
tmp = (-2.0d0) + (((-4.0d0) * y) / z)
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;
double tmp;
if (x <= -2.2e+109) {
tmp = t_0;
} else if (x <= 1.3e+164) {
tmp = -2.0 + ((-4.0 * y) / z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (4.0 * x) / z tmp = 0 if x <= -2.2e+109: tmp = t_0 elif x <= 1.3e+164: tmp = -2.0 + ((-4.0 * y) / z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(4.0 * x) / z) tmp = 0.0 if (x <= -2.2e+109) tmp = t_0; elseif (x <= 1.3e+164) tmp = Float64(-2.0 + Float64(Float64(-4.0 * y) / z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (4.0 * x) / z; tmp = 0.0; if (x <= -2.2e+109) tmp = t_0; elseif (x <= 1.3e+164) tmp = -2.0 + ((-4.0 * y) / z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(4.0 * x), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[x, -2.2e+109], t$95$0, If[LessEqual[x, 1.3e+164], N[(-2.0 + N[(N[(-4.0 * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{4 \cdot x}{z}\\
\mathbf{if}\;x \leq -2.2 \cdot 10^{+109}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+164}:\\
\;\;\;\;-2 + \frac{-4 \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.1999999999999999e109 or 1.3e164 < x Initial program 100.0%
Simplified0
Taylor expanded in x around inf 0
Simplified0
if -2.1999999999999999e109 < x < 1.3e164Initial program 100.0%
Simplified0
Taylor expanded in x around 0 0
Simplified0
(FPCore (x y z) :precision binary64 (if (<= z -7.2e+110) -2.0 (if (<= z 1.55e+72) (/ -4.0 (/ z y)) -2.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -7.2e+110) {
tmp = -2.0;
} else if (z <= 1.55e+72) {
tmp = -4.0 / (z / y);
} else {
tmp = -2.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 <= (-7.2d+110)) then
tmp = -2.0d0
else if (z <= 1.55d+72) then
tmp = (-4.0d0) / (z / y)
else
tmp = -2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -7.2e+110) {
tmp = -2.0;
} else if (z <= 1.55e+72) {
tmp = -4.0 / (z / y);
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -7.2e+110: tmp = -2.0 elif z <= 1.55e+72: tmp = -4.0 / (z / y) else: tmp = -2.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -7.2e+110) tmp = -2.0; elseif (z <= 1.55e+72) tmp = Float64(-4.0 / Float64(z / y)); else tmp = -2.0; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -7.2e+110) tmp = -2.0; elseif (z <= 1.55e+72) tmp = -4.0 / (z / y); else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -7.2e+110], -2.0, If[LessEqual[z, 1.55e+72], N[(-4.0 / N[(z / y), $MachinePrecision]), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+110}:\\
\;\;\;\;-2\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{+72}:\\
\;\;\;\;\frac{-4}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if z < -7.1999999999999994e110 or 1.54999999999999994e72 < z Initial program 100.0%
Simplified0
Taylor expanded in z around inf 0
Simplified0
if -7.1999999999999994e110 < z < 1.54999999999999994e72Initial program 100.0%
Simplified0
Taylor expanded in y around inf 0
Simplified0
Applied egg-rr0
(FPCore (x y z) :precision binary64 -2.0)
double code(double x, double y, double z) {
return -2.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = -2.0d0
end function
public static double code(double x, double y, double z) {
return -2.0;
}
def code(x, y, z): return -2.0
function code(x, y, z) return -2.0 end
function tmp = code(x, y, z) tmp = -2.0; end
code[x_, y_, z_] := -2.0
\begin{array}{l}
\\
-2
\end{array}
Initial program 100.0%
Simplified0
Taylor expanded in z around inf 0
Simplified0
(FPCore (x y z) :precision binary64 (- (* 4.0 (/ x z)) (+ 2.0 (* 4.0 (/ y z)))))
double code(double x, double y, double z) {
return (4.0 * (x / z)) - (2.0 + (4.0 * (y / z)));
}
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)) - (2.0d0 + (4.0d0 * (y / z)))
end function
public static double code(double x, double y, double z) {
return (4.0 * (x / z)) - (2.0 + (4.0 * (y / z)));
}
def code(x, y, z): return (4.0 * (x / z)) - (2.0 + (4.0 * (y / z)))
function code(x, y, z) return Float64(Float64(4.0 * Float64(x / z)) - Float64(2.0 + Float64(4.0 * Float64(y / z)))) end
function tmp = code(x, y, z) tmp = (4.0 * (x / z)) - (2.0 + (4.0 * (y / z))); end
code[x_, y_, z_] := N[(N[(4.0 * N[(x / z), $MachinePrecision]), $MachinePrecision] - N[(2.0 + N[(4.0 * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
4 \cdot \frac{x}{z} - \left(2 + 4 \cdot \frac{y}{z}\right)
\end{array}
herbie shell --seed 2024110
(FPCore (x y z)
:name "Data.Array.Repa.Algorithms.ColorRamp:rampColorHotToCold from repa-algorithms-3.4.0.1, B"
:precision binary64
:alt
(- (* 4.0 (/ x z)) (+ 2.0 (* 4.0 (/ y z))))
(/ (* 4.0 (- (- x y) (* z 0.5))) z))