
(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 11 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 (/ (- 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 82.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6497.0
Applied rewrites97.0%
Final simplification97.0%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.45e+220)
(* 1.0 x)
(if (<= z -0.0024)
(/ (* x z) (- z t))
(if (<= z 1.4e-37) (* (/ x (- t z)) y) (- x (/ (* x y) z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.45e+220) {
tmp = 1.0 * x;
} else if (z <= -0.0024) {
tmp = (x * z) / (z - t);
} else if (z <= 1.4e-37) {
tmp = (x / (t - z)) * y;
} else {
tmp = x - ((x * 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 <= (-1.45d+220)) then
tmp = 1.0d0 * x
else if (z <= (-0.0024d0)) then
tmp = (x * z) / (z - t)
else if (z <= 1.4d-37) then
tmp = (x / (t - z)) * y
else
tmp = x - ((x * y) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.45e+220) {
tmp = 1.0 * x;
} else if (z <= -0.0024) {
tmp = (x * z) / (z - t);
} else if (z <= 1.4e-37) {
tmp = (x / (t - z)) * y;
} else {
tmp = x - ((x * y) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.45e+220: tmp = 1.0 * x elif z <= -0.0024: tmp = (x * z) / (z - t) elif z <= 1.4e-37: tmp = (x / (t - z)) * y else: tmp = x - ((x * y) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.45e+220) tmp = Float64(1.0 * x); elseif (z <= -0.0024) tmp = Float64(Float64(x * z) / Float64(z - t)); elseif (z <= 1.4e-37) tmp = Float64(Float64(x / Float64(t - z)) * y); else tmp = Float64(x - Float64(Float64(x * y) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.45e+220) tmp = 1.0 * x; elseif (z <= -0.0024) tmp = (x * z) / (z - t); elseif (z <= 1.4e-37) tmp = (x / (t - z)) * y; else tmp = x - ((x * y) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.45e+220], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, -0.0024], N[(N[(x * z), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.4e-37], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(x - N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+220}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq -0.0024:\\
\;\;\;\;\frac{x \cdot z}{z - t}\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-37}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - \frac{x \cdot y}{z}\\
\end{array}
\end{array}
if z < -1.44999999999999996e220Initial program 59.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
Applied rewrites96.7%
if -1.44999999999999996e220 < z < -0.00239999999999999979Initial program 88.0%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6410.6
Applied rewrites10.6%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6475.3
Applied rewrites75.3%
if -0.00239999999999999979 < z < 1.4000000000000001e-37Initial program 90.2%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6482.2
Applied rewrites82.2%
if 1.4000000000000001e-37 < z Initial program 74.5%
Taylor expanded in t around 0
mul-1-negN/A
neg-sub0N/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
distribute-lft-outN/A
associate-/l*N/A
*-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6471.8
Applied rewrites71.8%
Final simplification79.3%
(FPCore (x y z t)
:precision binary64
(if (<= z -3000000000000.0)
(* 1.0 x)
(if (<= z 8e-284)
(* (/ x t) y)
(if (<= z 1.35e+62) (/ (* x y) t) (* 1.0 x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3000000000000.0) {
tmp = 1.0 * x;
} else if (z <= 8e-284) {
tmp = (x / t) * y;
} else if (z <= 1.35e+62) {
tmp = (x * y) / t;
} else {
tmp = 1.0 * 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 <= (-3000000000000.0d0)) then
tmp = 1.0d0 * x
else if (z <= 8d-284) then
tmp = (x / t) * y
else if (z <= 1.35d+62) then
tmp = (x * y) / t
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3000000000000.0) {
tmp = 1.0 * x;
} else if (z <= 8e-284) {
tmp = (x / t) * y;
} else if (z <= 1.35e+62) {
tmp = (x * y) / t;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3000000000000.0: tmp = 1.0 * x elif z <= 8e-284: tmp = (x / t) * y elif z <= 1.35e+62: tmp = (x * y) / t else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3000000000000.0) tmp = Float64(1.0 * x); elseif (z <= 8e-284) tmp = Float64(Float64(x / t) * y); elseif (z <= 1.35e+62) tmp = Float64(Float64(x * y) / t); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3000000000000.0) tmp = 1.0 * x; elseif (z <= 8e-284) tmp = (x / t) * y; elseif (z <= 1.35e+62) tmp = (x * y) / t; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3000000000000.0], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 8e-284], N[(N[(x / t), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 1.35e+62], N[(N[(x * y), $MachinePrecision] / t), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3000000000000:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-284}:\\
\;\;\;\;\frac{x}{t} \cdot y\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+62}:\\
\;\;\;\;\frac{x \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -3e12 or 1.35e62 < z Initial program 72.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
Applied rewrites60.4%
if -3e12 < z < 8.00000000000000029e-284Initial program 87.0%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6461.3
Applied rewrites61.3%
Applied rewrites70.5%
if 8.00000000000000029e-284 < z < 1.35e62Initial program 96.1%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6460.8
Applied rewrites60.8%
Final simplification63.2%
(FPCore (x y z t) :precision binary64 (if (<= z -1.12e+153) (* (/ z (- z t)) x) (if (<= z 1.62e+109) (* (/ x (- t z)) (- y z)) (* (/ (- z y) z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.12e+153) {
tmp = (z / (z - t)) * x;
} else if (z <= 1.62e+109) {
tmp = (x / (t - z)) * (y - z);
} else {
tmp = ((z - y) / z) * 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.12d+153)) then
tmp = (z / (z - t)) * x
else if (z <= 1.62d+109) then
tmp = (x / (t - z)) * (y - z)
else
tmp = ((z - y) / z) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.12e+153) {
tmp = (z / (z - t)) * x;
} else if (z <= 1.62e+109) {
tmp = (x / (t - z)) * (y - z);
} else {
tmp = ((z - y) / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.12e+153: tmp = (z / (z - t)) * x elif z <= 1.62e+109: tmp = (x / (t - z)) * (y - z) else: tmp = ((z - y) / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.12e+153) tmp = Float64(Float64(z / Float64(z - t)) * x); elseif (z <= 1.62e+109) tmp = Float64(Float64(x / Float64(t - z)) * Float64(y - z)); else tmp = Float64(Float64(Float64(z - y) / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.12e+153) tmp = (z / (z - t)) * x; elseif (z <= 1.62e+109) tmp = (x / (t - z)) * (y - z); else tmp = ((z - y) / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.12e+153], N[(N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 1.62e+109], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.12 \cdot 10^{+153}:\\
\;\;\;\;\frac{z}{z - t} \cdot x\\
\mathbf{elif}\;z \leq 1.62 \cdot 10^{+109}:\\
\;\;\;\;\frac{x}{t - z} \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z - y}{z} \cdot x\\
\end{array}
\end{array}
if z < -1.1200000000000001e153Initial program 69.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6498.7
Applied rewrites98.7%
if -1.1200000000000001e153 < z < 1.62e109Initial program 88.4%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6493.2
Applied rewrites93.2%
if 1.62e109 < z Initial program 68.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in t around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6479.8
Applied rewrites79.8%
(FPCore (x y z t) :precision binary64 (if (<= z -0.0024) (* (/ z (- z t)) x) (if (<= z 1.4e-37) (* (/ x (- t z)) y) (* (/ (- z y) z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.0024) {
tmp = (z / (z - t)) * x;
} else if (z <= 1.4e-37) {
tmp = (x / (t - z)) * y;
} else {
tmp = ((z - y) / z) * 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 <= (-0.0024d0)) then
tmp = (z / (z - t)) * x
else if (z <= 1.4d-37) then
tmp = (x / (t - z)) * y
else
tmp = ((z - y) / z) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.0024) {
tmp = (z / (z - t)) * x;
} else if (z <= 1.4e-37) {
tmp = (x / (t - z)) * y;
} else {
tmp = ((z - y) / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.0024: tmp = (z / (z - t)) * x elif z <= 1.4e-37: tmp = (x / (t - z)) * y else: tmp = ((z - y) / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.0024) tmp = Float64(Float64(z / Float64(z - t)) * x); elseif (z <= 1.4e-37) tmp = Float64(Float64(x / Float64(t - z)) * y); else tmp = Float64(Float64(Float64(z - y) / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.0024) tmp = (z / (z - t)) * x; elseif (z <= 1.4e-37) tmp = (x / (t - z)) * y; else tmp = ((z - y) / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.0024], N[(N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 1.4e-37], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0024:\\
\;\;\;\;\frac{z}{z - t} \cdot x\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-37}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{z - y}{z} \cdot x\\
\end{array}
\end{array}
if z < -0.00239999999999999979Initial program 78.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6484.9
Applied rewrites84.9%
if -0.00239999999999999979 < z < 1.4000000000000001e-37Initial program 90.2%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6482.2
Applied rewrites82.2%
if 1.4000000000000001e-37 < z Initial program 74.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in t around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6474.4
Applied rewrites74.4%
(FPCore (x y z t) :precision binary64 (if (<= z -0.0024) (* (/ z (- z t)) x) (if (<= z 1.4e-37) (* (/ x (- t z)) y) (- x (/ (* x y) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.0024) {
tmp = (z / (z - t)) * x;
} else if (z <= 1.4e-37) {
tmp = (x / (t - z)) * y;
} else {
tmp = x - ((x * 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.0024d0)) then
tmp = (z / (z - t)) * x
else if (z <= 1.4d-37) then
tmp = (x / (t - z)) * y
else
tmp = x - ((x * 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.0024) {
tmp = (z / (z - t)) * x;
} else if (z <= 1.4e-37) {
tmp = (x / (t - z)) * y;
} else {
tmp = x - ((x * y) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.0024: tmp = (z / (z - t)) * x elif z <= 1.4e-37: tmp = (x / (t - z)) * y else: tmp = x - ((x * y) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.0024) tmp = Float64(Float64(z / Float64(z - t)) * x); elseif (z <= 1.4e-37) tmp = Float64(Float64(x / Float64(t - z)) * y); else tmp = Float64(x - Float64(Float64(x * y) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.0024) tmp = (z / (z - t)) * x; elseif (z <= 1.4e-37) tmp = (x / (t - z)) * y; else tmp = x - ((x * y) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.0024], N[(N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 1.4e-37], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(x - N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0024:\\
\;\;\;\;\frac{z}{z - t} \cdot x\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-37}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - \frac{x \cdot y}{z}\\
\end{array}
\end{array}
if z < -0.00239999999999999979Initial program 78.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6484.9
Applied rewrites84.9%
if -0.00239999999999999979 < z < 1.4000000000000001e-37Initial program 90.2%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6482.2
Applied rewrites82.2%
if 1.4000000000000001e-37 < z Initial program 74.5%
Taylor expanded in t around 0
mul-1-negN/A
neg-sub0N/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
distribute-lft-outN/A
associate-/l*N/A
*-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6471.8
Applied rewrites71.8%
Final simplification80.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (/ (* x y) z))))
(if (<= z -2100000000000.0)
t_1
(if (<= z 1.4e-37) (* (/ x (- t z)) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x - ((x * y) / z);
double tmp;
if (z <= -2100000000000.0) {
tmp = t_1;
} else if (z <= 1.4e-37) {
tmp = (x / (t - z)) * y;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = x - ((x * y) / z)
if (z <= (-2100000000000.0d0)) then
tmp = t_1
else if (z <= 1.4d-37) then
tmp = (x / (t - z)) * y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x - ((x * y) / z);
double tmp;
if (z <= -2100000000000.0) {
tmp = t_1;
} else if (z <= 1.4e-37) {
tmp = (x / (t - z)) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - ((x * y) / z) tmp = 0 if z <= -2100000000000.0: tmp = t_1 elif z <= 1.4e-37: tmp = (x / (t - z)) * y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(Float64(x * y) / z)) tmp = 0.0 if (z <= -2100000000000.0) tmp = t_1; elseif (z <= 1.4e-37) tmp = Float64(Float64(x / Float64(t - z)) * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - ((x * y) / z); tmp = 0.0; if (z <= -2100000000000.0) tmp = t_1; elseif (z <= 1.4e-37) tmp = (x / (t - z)) * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2100000000000.0], t$95$1, If[LessEqual[z, 1.4e-37], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{x \cdot y}{z}\\
\mathbf{if}\;z \leq -2100000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-37}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.1e12 or 1.4000000000000001e-37 < z Initial program 76.0%
Taylor expanded in t around 0
mul-1-negN/A
neg-sub0N/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
distribute-lft-outN/A
associate-/l*N/A
*-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6471.4
Applied rewrites71.4%
if -2.1e12 < z < 1.4000000000000001e-37Initial program 90.4%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6481.8
Applied rewrites81.8%
Final simplification76.2%
(FPCore (x y z t) :precision binary64 (if (<= z -6000000000000.0) (* 1.0 x) (if (<= z 1.2e+90) (* (/ x (- t z)) y) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6000000000000.0) {
tmp = 1.0 * x;
} else if (z <= 1.2e+90) {
tmp = (x / (t - z)) * y;
} else {
tmp = 1.0 * 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 <= (-6000000000000.0d0)) then
tmp = 1.0d0 * x
else if (z <= 1.2d+90) then
tmp = (x / (t - z)) * y
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6000000000000.0) {
tmp = 1.0 * x;
} else if (z <= 1.2e+90) {
tmp = (x / (t - z)) * y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -6000000000000.0: tmp = 1.0 * x elif z <= 1.2e+90: tmp = (x / (t - z)) * y else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -6000000000000.0) tmp = Float64(1.0 * x); elseif (z <= 1.2e+90) tmp = Float64(Float64(x / Float64(t - z)) * y); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -6000000000000.0) tmp = 1.0 * x; elseif (z <= 1.2e+90) tmp = (x / (t - z)) * y; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -6000000000000.0], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 1.2e+90], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6000000000000:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+90}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -6e12 or 1.20000000000000005e90 < z Initial program 73.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
Applied rewrites63.5%
if -6e12 < z < 1.20000000000000005e90Initial program 90.1%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6476.1
Applied rewrites76.1%
(FPCore (x y z t) :precision binary64 (if (<= z -3000000000000.0) (* 1.0 x) (if (<= z 1.35e+62) (* (/ y t) x) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3000000000000.0) {
tmp = 1.0 * x;
} else if (z <= 1.35e+62) {
tmp = (y / t) * x;
} else {
tmp = 1.0 * 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 <= (-3000000000000.0d0)) then
tmp = 1.0d0 * x
else if (z <= 1.35d+62) then
tmp = (y / t) * x
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3000000000000.0) {
tmp = 1.0 * x;
} else if (z <= 1.35e+62) {
tmp = (y / t) * x;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3000000000000.0: tmp = 1.0 * x elif z <= 1.35e+62: tmp = (y / t) * x else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3000000000000.0) tmp = Float64(1.0 * x); elseif (z <= 1.35e+62) tmp = Float64(Float64(y / t) * x); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3000000000000.0) tmp = 1.0 * x; elseif (z <= 1.35e+62) tmp = (y / t) * x; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3000000000000.0], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 1.35e+62], N[(N[(y / t), $MachinePrecision] * x), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3000000000000:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+62}:\\
\;\;\;\;\frac{y}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -3e12 or 1.35e62 < z Initial program 72.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
Applied rewrites60.4%
if -3e12 < z < 1.35e62Initial program 91.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6494.5
Applied rewrites94.5%
Taylor expanded in z around 0
lower-/.f6465.3
Applied rewrites65.3%
(FPCore (x y z t) :precision binary64 (if (<= z -3000000000000.0) (* 1.0 x) (if (<= z 1.35e+62) (* (/ x t) y) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3000000000000.0) {
tmp = 1.0 * x;
} else if (z <= 1.35e+62) {
tmp = (x / t) * y;
} else {
tmp = 1.0 * 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 <= (-3000000000000.0d0)) then
tmp = 1.0d0 * x
else if (z <= 1.35d+62) then
tmp = (x / t) * y
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3000000000000.0) {
tmp = 1.0 * x;
} else if (z <= 1.35e+62) {
tmp = (x / t) * y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3000000000000.0: tmp = 1.0 * x elif z <= 1.35e+62: tmp = (x / t) * y else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3000000000000.0) tmp = Float64(1.0 * x); elseif (z <= 1.35e+62) tmp = Float64(Float64(x / t) * y); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3000000000000.0) tmp = 1.0 * x; elseif (z <= 1.35e+62) tmp = (x / t) * y; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3000000000000.0], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 1.35e+62], N[(N[(x / t), $MachinePrecision] * y), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3000000000000:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+62}:\\
\;\;\;\;\frac{x}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -3e12 or 1.35e62 < z Initial program 72.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
Applied rewrites60.4%
if -3e12 < z < 1.35e62Initial program 91.6%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6461.1
Applied rewrites61.1%
Applied rewrites62.6%
(FPCore (x y z t) :precision binary64 (* 1.0 x))
double code(double x, double y, double z, double t) {
return 1.0 * 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 = 1.0d0 * x
end function
public static double code(double x, double y, double z, double t) {
return 1.0 * x;
}
def code(x, y, z, t): return 1.0 * x
function code(x, y, z, t) return Float64(1.0 * x) end
function tmp = code(x, y, z, t) tmp = 1.0 * x; end
code[x_, y_, z_, t_] := N[(1.0 * x), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot x
\end{array}
Initial program 82.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6497.0
Applied rewrites97.0%
Taylor expanded in z around inf
Applied rewrites34.6%
(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 2024268
(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)))