
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
(FPCore (x y z t) :precision binary64 (/ x (/ (- t z) (- y z))))
double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / ((t - z) / (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
def code(x, y, z, t): return x / ((t - z) / (y - z))
function code(x, y, z, t) return Float64(x / Float64(Float64(t - z) / Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x / ((t - z) / (y - z)); end
code[x_, y_, z_, t_] := N[(x / N[(N[(t - z), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{t - z}{y - z}}
\end{array}
Initial program 86.7%
associate-/l*97.2%
Simplified97.2%
Taylor expanded in x around 0 86.7%
*-rgt-identity86.7%
times-frac85.1%
/-rgt-identity85.1%
associate-/r/97.2%
Simplified97.2%
(FPCore (x y z t)
:precision binary64
(if (<= z -3.9e+51)
(* x (/ z (- z t)))
(if (<= z 1.02e-69)
(/ (* x y) (- t z))
(if (<= z 0.076) (* x (/ (- y z) t)) (* x (- 1.0 (/ y z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.9e+51) {
tmp = x * (z / (z - t));
} else if (z <= 1.02e-69) {
tmp = (x * y) / (t - z);
} else if (z <= 0.076) {
tmp = x * ((y - z) / t);
} else {
tmp = x * (1.0 - (y / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-3.9d+51)) then
tmp = x * (z / (z - t))
else if (z <= 1.02d-69) then
tmp = (x * y) / (t - z)
else if (z <= 0.076d0) then
tmp = x * ((y - z) / t)
else
tmp = x * (1.0d0 - (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.9e+51) {
tmp = x * (z / (z - t));
} else if (z <= 1.02e-69) {
tmp = (x * y) / (t - z);
} else if (z <= 0.076) {
tmp = x * ((y - z) / t);
} else {
tmp = x * (1.0 - (y / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.9e+51: tmp = x * (z / (z - t)) elif z <= 1.02e-69: tmp = (x * y) / (t - z) elif z <= 0.076: tmp = x * ((y - z) / t) else: tmp = x * (1.0 - (y / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.9e+51) tmp = Float64(x * Float64(z / Float64(z - t))); elseif (z <= 1.02e-69) tmp = Float64(Float64(x * y) / Float64(t - z)); elseif (z <= 0.076) tmp = Float64(x * Float64(Float64(y - z) / t)); else tmp = Float64(x * Float64(1.0 - Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.9e+51) tmp = x * (z / (z - t)); elseif (z <= 1.02e-69) tmp = (x * y) / (t - z); elseif (z <= 0.076) tmp = x * ((y - z) / t); else tmp = x * (1.0 - (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.9e+51], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.02e-69], N[(N[(x * y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.076], N[(x * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{+51}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{-69}:\\
\;\;\;\;\frac{x \cdot y}{t - z}\\
\mathbf{elif}\;z \leq 0.076:\\
\;\;\;\;x \cdot \frac{y - z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\
\end{array}
\end{array}
if z < -3.89999999999999984e51Initial program 75.4%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in y around 0 59.4%
mul-1-neg59.4%
distribute-neg-frac259.4%
sub-neg59.4%
distribute-neg-in59.4%
remove-double-neg59.4%
+-commutative59.4%
sub-neg59.4%
associate-/l*81.7%
Simplified81.7%
if -3.89999999999999984e51 < z < 1.02000000000000005e-69Initial program 95.6%
associate-/l*94.5%
Simplified94.5%
Taylor expanded in y around inf 84.0%
if 1.02000000000000005e-69 < z < 0.0759999999999999981Initial program 95.0%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in t around inf 70.5%
associate-/l*75.2%
Simplified75.2%
if 0.0759999999999999981 < z Initial program 74.4%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in t around 0 56.2%
mul-1-neg56.2%
associate-/l*75.8%
distribute-rgt-neg-in75.8%
distribute-frac-neg75.8%
sub-neg75.8%
distribute-neg-in75.8%
remove-double-neg75.8%
+-commutative75.8%
sub-neg75.8%
div-sub75.8%
*-inverses75.8%
Simplified75.8%
(FPCore (x y z t)
:precision binary64
(if (<= z -3.5e+51)
(* x (/ z (- z t)))
(if (<= z 2.25e-69)
(/ x (/ (- t z) y))
(if (<= z 35.0) (* x (/ (- y z) t)) (* x (- 1.0 (/ y z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.5e+51) {
tmp = x * (z / (z - t));
} else if (z <= 2.25e-69) {
tmp = x / ((t - z) / y);
} else if (z <= 35.0) {
tmp = x * ((y - z) / t);
} else {
tmp = x * (1.0 - (y / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-3.5d+51)) then
tmp = x * (z / (z - t))
else if (z <= 2.25d-69) then
tmp = x / ((t - z) / y)
else if (z <= 35.0d0) then
tmp = x * ((y - z) / t)
else
tmp = x * (1.0d0 - (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.5e+51) {
tmp = x * (z / (z - t));
} else if (z <= 2.25e-69) {
tmp = x / ((t - z) / y);
} else if (z <= 35.0) {
tmp = x * ((y - z) / t);
} else {
tmp = x * (1.0 - (y / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.5e+51: tmp = x * (z / (z - t)) elif z <= 2.25e-69: tmp = x / ((t - z) / y) elif z <= 35.0: tmp = x * ((y - z) / t) else: tmp = x * (1.0 - (y / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.5e+51) tmp = Float64(x * Float64(z / Float64(z - t))); elseif (z <= 2.25e-69) tmp = Float64(x / Float64(Float64(t - z) / y)); elseif (z <= 35.0) tmp = Float64(x * Float64(Float64(y - z) / t)); else tmp = Float64(x * Float64(1.0 - Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.5e+51) tmp = x * (z / (z - t)); elseif (z <= 2.25e-69) tmp = x / ((t - z) / y); elseif (z <= 35.0) tmp = x * ((y - z) / t); else tmp = x * (1.0 - (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.5e+51], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.25e-69], N[(x / N[(N[(t - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 35.0], N[(x * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+51}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{-69}:\\
\;\;\;\;\frac{x}{\frac{t - z}{y}}\\
\mathbf{elif}\;z \leq 35:\\
\;\;\;\;x \cdot \frac{y - z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\
\end{array}
\end{array}
if z < -3.5e51Initial program 75.4%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in y around 0 59.4%
mul-1-neg59.4%
distribute-neg-frac259.4%
sub-neg59.4%
distribute-neg-in59.4%
remove-double-neg59.4%
+-commutative59.4%
sub-neg59.4%
associate-/l*81.7%
Simplified81.7%
if -3.5e51 < z < 2.25000000000000005e-69Initial program 95.6%
associate-/l*94.5%
Simplified94.5%
Taylor expanded in x around 0 95.6%
*-rgt-identity95.6%
times-frac88.6%
/-rgt-identity88.6%
associate-/r/94.5%
Simplified94.5%
Taylor expanded in y around inf 82.0%
if 2.25000000000000005e-69 < z < 35Initial program 95.0%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in t around inf 70.5%
associate-/l*75.2%
Simplified75.2%
if 35 < z Initial program 74.4%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in t around 0 56.2%
mul-1-neg56.2%
associate-/l*75.8%
distribute-rgt-neg-in75.8%
distribute-frac-neg75.8%
sub-neg75.8%
distribute-neg-in75.8%
remove-double-neg75.8%
+-commutative75.8%
sub-neg75.8%
div-sub75.8%
*-inverses75.8%
Simplified75.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.35e+23) (not (<= z 3.9e-32))) (* x (- 1.0 (/ y z))) (/ (* x y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.35e+23) || !(z <= 3.9e-32)) {
tmp = x * (1.0 - (y / z));
} else {
tmp = (x * y) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-2.35d+23)) .or. (.not. (z <= 3.9d-32))) then
tmp = x * (1.0d0 - (y / z))
else
tmp = (x * y) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.35e+23) || !(z <= 3.9e-32)) {
tmp = x * (1.0 - (y / z));
} else {
tmp = (x * y) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.35e+23) or not (z <= 3.9e-32): tmp = x * (1.0 - (y / z)) else: tmp = (x * y) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.35e+23) || !(z <= 3.9e-32)) tmp = Float64(x * Float64(1.0 - Float64(y / z))); else tmp = Float64(Float64(x * y) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.35e+23) || ~((z <= 3.9e-32))) tmp = x * (1.0 - (y / z)); else tmp = (x * y) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.35e+23], N[Not[LessEqual[z, 3.9e-32]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.35 \cdot 10^{+23} \lor \neg \left(z \leq 3.9 \cdot 10^{-32}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{t}\\
\end{array}
\end{array}
if z < -2.3499999999999999e23 or 3.9000000000000001e-32 < z Initial program 77.3%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in t around 0 55.8%
mul-1-neg55.8%
associate-/l*73.2%
distribute-rgt-neg-in73.2%
distribute-frac-neg73.2%
sub-neg73.2%
distribute-neg-in73.2%
remove-double-neg73.2%
+-commutative73.2%
sub-neg73.2%
div-sub73.2%
*-inverses73.2%
Simplified73.2%
if -2.3499999999999999e23 < z < 3.9000000000000001e-32Initial program 95.7%
associate-/l*94.7%
Simplified94.7%
Taylor expanded in z around 0 67.4%
Final simplification70.2%
(FPCore (x y z t) :precision binary64 (if (<= z -4e+28) (* x (/ z (- z t))) (if (<= z 0.088) (* x (/ (- y z) t)) (* x (- 1.0 (/ y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4e+28) {
tmp = x * (z / (z - t));
} else if (z <= 0.088) {
tmp = x * ((y - z) / t);
} else {
tmp = x * (1.0 - (y / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-4d+28)) then
tmp = x * (z / (z - t))
else if (z <= 0.088d0) then
tmp = x * ((y - z) / t)
else
tmp = x * (1.0d0 - (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4e+28) {
tmp = x * (z / (z - t));
} else if (z <= 0.088) {
tmp = x * ((y - z) / t);
} else {
tmp = x * (1.0 - (y / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4e+28: tmp = x * (z / (z - t)) elif z <= 0.088: tmp = x * ((y - z) / t) else: tmp = x * (1.0 - (y / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4e+28) tmp = Float64(x * Float64(z / Float64(z - t))); elseif (z <= 0.088) tmp = Float64(x * Float64(Float64(y - z) / t)); else tmp = Float64(x * Float64(1.0 - Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4e+28) tmp = x * (z / (z - t)); elseif (z <= 0.088) tmp = x * ((y - z) / t); else tmp = x * (1.0 - (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4e+28], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.088], N[(x * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+28}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\mathbf{elif}\;z \leq 0.088:\\
\;\;\;\;x \cdot \frac{y - z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\
\end{array}
\end{array}
if z < -3.99999999999999983e28Initial program 77.4%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 58.7%
mul-1-neg58.7%
distribute-neg-frac258.7%
sub-neg58.7%
distribute-neg-in58.7%
remove-double-neg58.7%
+-commutative58.7%
sub-neg58.7%
associate-/l*79.3%
Simplified79.3%
if -3.99999999999999983e28 < z < 0.087999999999999995Initial program 95.4%
associate-/l*95.1%
Simplified95.1%
Taylor expanded in t around inf 75.5%
associate-/l*76.0%
Simplified76.0%
if 0.087999999999999995 < z Initial program 74.4%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in t around 0 56.2%
mul-1-neg56.2%
associate-/l*75.8%
distribute-rgt-neg-in75.8%
distribute-frac-neg75.8%
sub-neg75.8%
distribute-neg-in75.8%
remove-double-neg75.8%
+-commutative75.8%
sub-neg75.8%
div-sub75.8%
*-inverses75.8%
Simplified75.8%
(FPCore (x y z t) :precision binary64 (if (<= z -0.225) (* x (/ z (- z t))) (if (<= z 4e-32) (/ (* x y) t) (* x (- 1.0 (/ y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.225) {
tmp = x * (z / (z - t));
} else if (z <= 4e-32) {
tmp = (x * y) / t;
} else {
tmp = x * (1.0 - (y / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-0.225d0)) then
tmp = x * (z / (z - t))
else if (z <= 4d-32) then
tmp = (x * y) / t
else
tmp = x * (1.0d0 - (y / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.225) {
tmp = x * (z / (z - t));
} else if (z <= 4e-32) {
tmp = (x * y) / t;
} else {
tmp = x * (1.0 - (y / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.225: tmp = x * (z / (z - t)) elif z <= 4e-32: tmp = (x * y) / t else: tmp = x * (1.0 - (y / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.225) tmp = Float64(x * Float64(z / Float64(z - t))); elseif (z <= 4e-32) tmp = Float64(Float64(x * y) / t); else tmp = Float64(x * Float64(1.0 - Float64(y / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.225) tmp = x * (z / (z - t)); elseif (z <= 4e-32) tmp = (x * y) / t; else tmp = x * (1.0 - (y / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.225], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4e-32], N[(N[(x * y), $MachinePrecision] / t), $MachinePrecision], N[(x * N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.225:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-32}:\\
\;\;\;\;\frac{x \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{z}\right)\\
\end{array}
\end{array}
if z < -0.225000000000000006Initial program 77.8%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in y around 0 58.4%
mul-1-neg58.4%
distribute-neg-frac258.4%
sub-neg58.4%
distribute-neg-in58.4%
remove-double-neg58.4%
+-commutative58.4%
sub-neg58.4%
associate-/l*78.5%
Simplified78.5%
if -0.225000000000000006 < z < 4.00000000000000022e-32Initial program 95.7%
associate-/l*94.6%
Simplified94.6%
Taylor expanded in z around 0 68.0%
if 4.00000000000000022e-32 < z Initial program 77.2%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in t around 0 54.0%
mul-1-neg54.0%
associate-/l*70.5%
distribute-rgt-neg-in70.5%
distribute-frac-neg70.5%
sub-neg70.5%
distribute-neg-in70.5%
remove-double-neg70.5%
+-commutative70.5%
sub-neg70.5%
div-sub70.5%
*-inverses70.5%
Simplified70.5%
(FPCore (x y z t) :precision binary64 (if (<= z -1.05e+154) x (if (<= z 400.0) (* x (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.05e+154) {
tmp = x;
} else if (z <= 400.0) {
tmp = x * (y / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.05d+154)) then
tmp = x
else if (z <= 400.0d0) then
tmp = x * (y / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.05e+154) {
tmp = x;
} else if (z <= 400.0) {
tmp = x * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.05e+154: tmp = x elif z <= 400.0: tmp = x * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.05e+154) tmp = x; elseif (z <= 400.0) tmp = Float64(x * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.05e+154) tmp = x; elseif (z <= 400.0) tmp = x * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.05e+154], x, If[LessEqual[z, 400.0], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+154}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 400:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.04999999999999997e154 or 400 < z Initial program 74.1%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around inf 63.3%
if -1.04999999999999997e154 < z < 400Initial program 94.1%
associate-/l*95.6%
Simplified95.6%
Taylor expanded in z around 0 60.5%
associate-/l*61.2%
Simplified61.2%
(FPCore (x y z t) :precision binary64 (* x (/ (- y z) (- t z))))
double code(double x, double y, double z, double t) {
return x * ((y - z) / (t - z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y - z) / (t - z))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y - z) / (t - z));
}
def code(x, y, z, t): return x * ((y - z) / (t - z))
function code(x, y, z, t) return Float64(x * Float64(Float64(y - z) / Float64(t - z))) end
function tmp = code(x, y, z, t) tmp = x * ((y - z) / (t - z)); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y - z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{y - z}{t - z}
\end{array}
Initial program 86.7%
associate-/l*97.2%
Simplified97.2%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 86.7%
associate-/l*97.2%
Simplified97.2%
Taylor expanded in z around inf 30.9%
(FPCore (x y z t) :precision binary64 (/ x (/ (- t z) (- y z))))
double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / ((t - z) / (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
def code(x, y, z, t): return x / ((t - z) / (y - z))
function code(x, y, z, t) return Float64(x / Float64(Float64(t - z) / Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x / ((t - z) / (y - z)); end
code[x_, y_, z_, t_] := N[(x / N[(N[(t - z), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{t - z}{y - z}}
\end{array}
herbie shell --seed 2024170
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (/ x (/ (- t z) (- y z))))
(/ (* x (- y z)) (- t z)))