
(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 9 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 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%
Final simplification100.0%
(FPCore (x y z)
:precision binary64
(if (<= y -5.1e+147)
4.0
(if (or (<= y -0.007) (and (not (<= y -3.2e-64)) (<= y 1.85e+160)))
(* 4.0 (/ (- x z) y))
4.0)))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.1e+147) {
tmp = 4.0;
} else if ((y <= -0.007) || (!(y <= -3.2e-64) && (y <= 1.85e+160))) {
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 <= (-5.1d+147)) then
tmp = 4.0d0
else if ((y <= (-0.007d0)) .or. (.not. (y <= (-3.2d-64))) .and. (y <= 1.85d+160)) 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 <= -5.1e+147) {
tmp = 4.0;
} else if ((y <= -0.007) || (!(y <= -3.2e-64) && (y <= 1.85e+160))) {
tmp = 4.0 * ((x - z) / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.1e+147: tmp = 4.0 elif (y <= -0.007) or (not (y <= -3.2e-64) and (y <= 1.85e+160)): tmp = 4.0 * ((x - z) / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.1e+147) tmp = 4.0; elseif ((y <= -0.007) || (!(y <= -3.2e-64) && (y <= 1.85e+160))) 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 <= -5.1e+147) tmp = 4.0; elseif ((y <= -0.007) || (~((y <= -3.2e-64)) && (y <= 1.85e+160))) tmp = 4.0 * ((x - z) / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.1e+147], 4.0, If[Or[LessEqual[y, -0.007], And[N[Not[LessEqual[y, -3.2e-64]], $MachinePrecision], LessEqual[y, 1.85e+160]]], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], 4.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.1 \cdot 10^{+147}:\\
\;\;\;\;4\\
\mathbf{elif}\;y \leq -0.007 \lor \neg \left(y \leq -3.2 \cdot 10^{-64}\right) \land y \leq 1.85 \cdot 10^{+160}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if y < -5.09999999999999999e147 or -0.00700000000000000015 < y < -3.19999999999999975e-64 or 1.85000000000000008e160 < y Initial program 99.9%
Taylor expanded in y around inf 83.2%
if -5.09999999999999999e147 < y < -0.00700000000000000015 or -3.19999999999999975e-64 < y < 1.85000000000000008e160Initial program 100.0%
Taylor expanded in y around 0 100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in y around 0 85.5%
Final simplification84.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 4.0 (/ x y))))
(if (<= x -2.75e+102)
t_0
(if (<= x -1.02e-11)
4.0
(if (<= x -2.15e-182) (* -4.0 (/ z y)) (if (<= x 3.8e+131) 4.0 t_0))))))
double code(double x, double y, double z) {
double t_0 = 4.0 * (x / y);
double tmp;
if (x <= -2.75e+102) {
tmp = t_0;
} else if (x <= -1.02e-11) {
tmp = 4.0;
} else if (x <= -2.15e-182) {
tmp = -4.0 * (z / y);
} else if (x <= 3.8e+131) {
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 * (x / y)
if (x <= (-2.75d+102)) then
tmp = t_0
else if (x <= (-1.02d-11)) then
tmp = 4.0d0
else if (x <= (-2.15d-182)) then
tmp = (-4.0d0) * (z / y)
else if (x <= 3.8d+131) 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 * (x / y);
double tmp;
if (x <= -2.75e+102) {
tmp = t_0;
} else if (x <= -1.02e-11) {
tmp = 4.0;
} else if (x <= -2.15e-182) {
tmp = -4.0 * (z / y);
} else if (x <= 3.8e+131) {
tmp = 4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 4.0 * (x / y) tmp = 0 if x <= -2.75e+102: tmp = t_0 elif x <= -1.02e-11: tmp = 4.0 elif x <= -2.15e-182: tmp = -4.0 * (z / y) elif x <= 3.8e+131: tmp = 4.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(4.0 * Float64(x / y)) tmp = 0.0 if (x <= -2.75e+102) tmp = t_0; elseif (x <= -1.02e-11) tmp = 4.0; elseif (x <= -2.15e-182) tmp = Float64(-4.0 * Float64(z / y)); elseif (x <= 3.8e+131) tmp = 4.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 4.0 * (x / y); tmp = 0.0; if (x <= -2.75e+102) tmp = t_0; elseif (x <= -1.02e-11) tmp = 4.0; elseif (x <= -2.15e-182) tmp = -4.0 * (z / y); elseif (x <= 3.8e+131) tmp = 4.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.75e+102], t$95$0, If[LessEqual[x, -1.02e-11], 4.0, If[LessEqual[x, -2.15e-182], N[(-4.0 * N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.8e+131], 4.0, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 4 \cdot \frac{x}{y}\\
\mathbf{if}\;x \leq -2.75 \cdot 10^{+102}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1.02 \cdot 10^{-11}:\\
\;\;\;\;4\\
\mathbf{elif}\;x \leq -2.15 \cdot 10^{-182}:\\
\;\;\;\;-4 \cdot \frac{z}{y}\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{+131}:\\
\;\;\;\;4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.74999999999999991e102 or 3.8000000000000004e131 < x Initial program 100.0%
Taylor expanded in y around 0 99.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in x around inf 75.8%
if -2.74999999999999991e102 < x < -1.01999999999999994e-11 or -2.15e-182 < x < 3.8000000000000004e131Initial program 99.9%
Taylor expanded in y around inf 55.5%
if -1.01999999999999994e-11 < x < -2.15e-182Initial program 100.0%
Taylor expanded in y around 0 100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in z around inf 66.0%
*-commutative66.0%
Simplified66.0%
Final simplification63.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.1e+105) (not (<= z 3.5e+123))) (* 4.0 (/ (- x z) y)) (+ 4.0 (/ (* 4.0 x) y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.1e+105) || !(z <= 3.5e+123)) {
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 <= (-1.1d+105)) .or. (.not. (z <= 3.5d+123))) 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 <= -1.1e+105) || !(z <= 3.5e+123)) {
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 <= -1.1e+105) or not (z <= 3.5e+123): 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 <= -1.1e+105) || !(z <= 3.5e+123)) tmp = Float64(4.0 * Float64(Float64(x - z) / 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 ((z <= -1.1e+105) || ~((z <= 3.5e+123))) 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, -1.1e+105], N[Not[LessEqual[z, 3.5e+123]], $MachinePrecision]], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(4.0 + N[(N[(4.0 * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{+105} \lor \neg \left(z \leq 3.5 \cdot 10^{+123}\right):\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + \frac{4 \cdot x}{y}\\
\end{array}
\end{array}
if z < -1.10000000000000003e105 or 3.5e123 < z Initial program 99.9%
Taylor expanded in y around 0 98.8%
distribute-lft-out98.8%
Simplified98.8%
Taylor expanded in y around 0 90.8%
if -1.10000000000000003e105 < z < 3.5e123Initial 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 z around 0 89.1%
distribute-lft-in89.1%
metadata-eval89.1%
associate-+r+89.1%
metadata-eval89.1%
*-commutative89.1%
associate-*l/89.1%
Simplified89.1%
Final simplification89.7%
(FPCore (x y z) :precision binary64 (if (<= x -4.15e+102) (* 4.0 (/ (- x z) y)) (if (<= x 1.8e-36) (+ 4.0 (/ (* z -4.0) y)) (+ 4.0 (/ (* 4.0 x) y)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.15e+102) {
tmp = 4.0 * ((x - z) / y);
} else if (x <= 1.8e-36) {
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 <= (-4.15d+102)) then
tmp = 4.0d0 * ((x - z) / y)
else if (x <= 1.8d-36) 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 <= -4.15e+102) {
tmp = 4.0 * ((x - z) / y);
} else if (x <= 1.8e-36) {
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 <= -4.15e+102: tmp = 4.0 * ((x - z) / y) elif x <= 1.8e-36: 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 <= -4.15e+102) tmp = Float64(4.0 * Float64(Float64(x - z) / y)); elseif (x <= 1.8e-36) 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 <= -4.15e+102) tmp = 4.0 * ((x - z) / y); elseif (x <= 1.8e-36) 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, -4.15e+102], N[(4.0 * N[(N[(x - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.8e-36], 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 -4.15 \cdot 10^{+102}:\\
\;\;\;\;4 \cdot \frac{x - z}{y}\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-36}:\\
\;\;\;\;4 + \frac{z \cdot -4}{y}\\
\mathbf{else}:\\
\;\;\;\;4 + \frac{4 \cdot x}{y}\\
\end{array}
\end{array}
if x < -4.1500000000000002e102Initial program 99.9%
Taylor expanded in y around 0 99.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in y around 0 89.3%
if -4.1500000000000002e102 < x < 1.80000000000000016e-36Initial 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 93.0%
sub-neg93.0%
distribute-lft-in93.0%
metadata-eval93.0%
associate-+r+93.1%
metadata-eval93.1%
neg-mul-193.1%
associate-*r*93.1%
metadata-eval93.1%
*-commutative93.1%
associate-*l/93.1%
Simplified93.1%
if 1.80000000000000016e-36 < 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-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%
*-commutative90.9%
associate-*l/90.9%
Simplified90.9%
Final simplification91.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -2.2e+103) (not (<= x 3.1e+130))) (* 4.0 (/ x y)) 4.0))
double code(double x, double y, double z) {
double tmp;
if ((x <= -2.2e+103) || !(x <= 3.1e+130)) {
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.2d+103)) .or. (.not. (x <= 3.1d+130))) 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.2e+103) || !(x <= 3.1e+130)) {
tmp = 4.0 * (x / y);
} else {
tmp = 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -2.2e+103) or not (x <= 3.1e+130): tmp = 4.0 * (x / y) else: tmp = 4.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -2.2e+103) || !(x <= 3.1e+130)) 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.2e+103) || ~((x <= 3.1e+130))) tmp = 4.0 * (x / y); else tmp = 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -2.2e+103], N[Not[LessEqual[x, 3.1e+130]], $MachinePrecision]], N[(4.0 * N[(x / y), $MachinePrecision]), $MachinePrecision], 4.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{+103} \lor \neg \left(x \leq 3.1 \cdot 10^{+130}\right):\\
\;\;\;\;4 \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
\end{array}
if x < -2.19999999999999992e103 or 3.1e130 < x Initial program 100.0%
Taylor expanded in y around 0 99.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in x around inf 75.8%
if -2.19999999999999992e103 < x < 3.1e130Initial program 99.9%
Taylor expanded in y around inf 49.5%
Final simplification58.6%
(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(Float64(4.0 * Float64(Float64(x + 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[(N[(4.0 * N[(N[(x + N[(0.75 * y), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{4 \cdot \left(\left(x + 0.75 \cdot y\right) - z\right)}{y}
\end{array}
Initial program 100.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 100.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 100.0%
Taylor expanded in y around inf 37.5%
Final simplification37.5%
herbie shell --seed 2024076
(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)))