
(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 (/ (- 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 85.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6495.6
Applied rewrites95.6%
Final simplification95.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma x (/ (- y) z) x)))
(if (<= z -5.3e-21)
t_1
(if (<= z -5.8e-275)
(* (/ x (- t z)) y)
(if (<= z 2.8e+68) (/ (* x y) (- t z)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = fma(x, (-y / z), x);
double tmp;
if (z <= -5.3e-21) {
tmp = t_1;
} else if (z <= -5.8e-275) {
tmp = (x / (t - z)) * y;
} else if (z <= 2.8e+68) {
tmp = (x * y) / (t - z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(x, Float64(Float64(-y) / z), x) tmp = 0.0 if (z <= -5.3e-21) tmp = t_1; elseif (z <= -5.8e-275) tmp = Float64(Float64(x / Float64(t - z)) * y); elseif (z <= 2.8e+68) tmp = Float64(Float64(x * y) / Float64(t - z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[((-y) / z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -5.3e-21], t$95$1, If[LessEqual[z, -5.8e-275], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 2.8e+68], N[(N[(x * y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, \frac{-y}{z}, x\right)\\
\mathbf{if}\;z \leq -5.3 \cdot 10^{-21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -5.8 \cdot 10^{-275}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+68}:\\
\;\;\;\;\frac{x \cdot y}{t - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.2999999999999999e-21 or 2.8e68 < z Initial program 75.6%
Taylor expanded in z around inf
mul-1-negN/A
unsub-negN/A
associate--r+N/A
mul-1-negN/A
sub-negN/A
div-subN/A
unsub-negN/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
distribute-neg-frac2N/A
*-commutativeN/A
distribute-lft-out--N/A
mul-1-negN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites81.7%
Taylor expanded in y around inf
Applied rewrites81.8%
if -5.2999999999999999e-21 < z < -5.800000000000001e-275Initial program 88.9%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6482.6
Applied rewrites82.6%
if -5.800000000000001e-275 < z < 2.8e68Initial program 95.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6480.6
Applied rewrites80.6%
Final simplification81.6%
(FPCore (x y z t)
:precision binary64
(if (<= z -2.3e+14)
(* 1.0 x)
(if (<= z -1.55e-40)
(/ (* (- z) x) t)
(if (<= z 370.0) (* (/ x t) y) (* 1.0 x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.3e+14) {
tmp = 1.0 * x;
} else if (z <= -1.55e-40) {
tmp = (-z * x) / t;
} else if (z <= 370.0) {
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 <= (-2.3d+14)) then
tmp = 1.0d0 * x
else if (z <= (-1.55d-40)) then
tmp = (-z * x) / t
else if (z <= 370.0d0) 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 <= -2.3e+14) {
tmp = 1.0 * x;
} else if (z <= -1.55e-40) {
tmp = (-z * x) / t;
} else if (z <= 370.0) {
tmp = (x / t) * y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.3e+14: tmp = 1.0 * x elif z <= -1.55e-40: tmp = (-z * x) / t elif z <= 370.0: tmp = (x / t) * y else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.3e+14) tmp = Float64(1.0 * x); elseif (z <= -1.55e-40) tmp = Float64(Float64(Float64(-z) * x) / t); elseif (z <= 370.0) 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 <= -2.3e+14) tmp = 1.0 * x; elseif (z <= -1.55e-40) tmp = (-z * x) / t; elseif (z <= 370.0) tmp = (x / t) * y; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.3e+14], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, -1.55e-40], N[(N[((-z) * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 370.0], N[(N[(x / t), $MachinePrecision] * y), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+14}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq -1.55 \cdot 10^{-40}:\\
\;\;\;\;\frac{\left(-z\right) \cdot x}{t}\\
\mathbf{elif}\;z \leq 370:\\
\;\;\;\;\frac{x}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -2.3e14 or 370 < z Initial program 75.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 z around inf
Applied rewrites60.5%
if -2.3e14 < z < -1.55000000000000005e-40Initial program 99.6%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6461.0
Applied rewrites61.0%
Taylor expanded in y around 0
Applied rewrites55.9%
if -1.55000000000000005e-40 < z < 370Initial program 92.0%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6465.9
Applied rewrites65.9%
Applied rewrites67.4%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.3e-22)
(* 1.0 x)
(if (<= z -1.55e-40)
(* (/ x (- t)) z)
(if (<= z 370.0) (* (/ x t) y) (* 1.0 x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.3e-22) {
tmp = 1.0 * x;
} else if (z <= -1.55e-40) {
tmp = (x / -t) * z;
} else if (z <= 370.0) {
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 <= (-1.3d-22)) then
tmp = 1.0d0 * x
else if (z <= (-1.55d-40)) then
tmp = (x / -t) * z
else if (z <= 370.0d0) 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 <= -1.3e-22) {
tmp = 1.0 * x;
} else if (z <= -1.55e-40) {
tmp = (x / -t) * z;
} else if (z <= 370.0) {
tmp = (x / t) * y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.3e-22: tmp = 1.0 * x elif z <= -1.55e-40: tmp = (x / -t) * z elif z <= 370.0: tmp = (x / t) * y else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.3e-22) tmp = Float64(1.0 * x); elseif (z <= -1.55e-40) tmp = Float64(Float64(x / Float64(-t)) * z); elseif (z <= 370.0) 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 <= -1.3e-22) tmp = 1.0 * x; elseif (z <= -1.55e-40) tmp = (x / -t) * z; elseif (z <= 370.0) tmp = (x / t) * y; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.3e-22], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, -1.55e-40], N[(N[(x / (-t)), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, 370.0], N[(N[(x / t), $MachinePrecision] * y), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{-22}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq -1.55 \cdot 10^{-40}:\\
\;\;\;\;\frac{x}{-t} \cdot z\\
\mathbf{elif}\;z \leq 370:\\
\;\;\;\;\frac{x}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -1.3e-22 or 370 < z Initial program 77.4%
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 rewrites58.7%
if -1.3e-22 < z < -1.55000000000000005e-40Initial program 99.7%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6466.5
Applied rewrites66.5%
Taylor expanded in y around 0
Applied rewrites83.9%
if -1.55000000000000005e-40 < z < 370Initial program 92.0%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6465.9
Applied rewrites65.9%
Applied rewrites67.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma x (/ (- y) z) x))) (if (<= z -5.3e-21) t_1 (if (<= z 55.0) (* (/ x (- t z)) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(x, (-y / z), x);
double tmp;
if (z <= -5.3e-21) {
tmp = t_1;
} else if (z <= 55.0) {
tmp = (x / (t - z)) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(x, Float64(Float64(-y) / z), x) tmp = 0.0 if (z <= -5.3e-21) tmp = t_1; elseif (z <= 55.0) tmp = Float64(Float64(x / Float64(t - z)) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[((-y) / z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -5.3e-21], t$95$1, If[LessEqual[z, 55.0], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, \frac{-y}{z}, x\right)\\
\mathbf{if}\;z \leq -5.3 \cdot 10^{-21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 55:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.2999999999999999e-21 or 55 < z Initial program 77.2%
Taylor expanded in z around inf
mul-1-negN/A
unsub-negN/A
associate--r+N/A
mul-1-negN/A
sub-negN/A
div-subN/A
unsub-negN/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
distribute-neg-frac2N/A
*-commutativeN/A
distribute-lft-out--N/A
mul-1-negN/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites79.7%
Taylor expanded in y around inf
Applied rewrites79.8%
if -5.2999999999999999e-21 < z < 55Initial program 92.4%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6480.2
Applied rewrites80.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- x (/ (* x y) z)))) (if (<= z -1.25e-26) t_1 (if (<= z 55.0) (* (/ 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 <= -1.25e-26) {
tmp = t_1;
} else if (z <= 55.0) {
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 <= (-1.25d-26)) then
tmp = t_1
else if (z <= 55.0d0) 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 <= -1.25e-26) {
tmp = t_1;
} else if (z <= 55.0) {
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 <= -1.25e-26: tmp = t_1 elif z <= 55.0: 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 <= -1.25e-26) tmp = t_1; elseif (z <= 55.0) 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 <= -1.25e-26) tmp = t_1; elseif (z <= 55.0) 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, -1.25e-26], t$95$1, If[LessEqual[z, 55.0], 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 -1.25 \cdot 10^{-26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 55:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.25000000000000005e-26 or 55 < z Initial program 77.7%
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-rgt-inN/A
*-commutativeN/A
associate-/l*N/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-*.f6472.0
Applied rewrites72.0%
if -1.25000000000000005e-26 < z < 55Initial program 92.2%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6480.5
Applied rewrites80.5%
Final simplification76.4%
(FPCore (x y z t) :precision binary64 (if (<= z -1.65e+63) (* 1.0 x) (if (<= z 8.5e+102) (* (/ x (- t z)) y) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.65e+63) {
tmp = 1.0 * x;
} else if (z <= 8.5e+102) {
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 <= (-1.65d+63)) then
tmp = 1.0d0 * x
else if (z <= 8.5d+102) 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 <= -1.65e+63) {
tmp = 1.0 * x;
} else if (z <= 8.5e+102) {
tmp = (x / (t - z)) * y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.65e+63: tmp = 1.0 * x elif z <= 8.5e+102: tmp = (x / (t - z)) * y else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.65e+63) tmp = Float64(1.0 * x); elseif (z <= 8.5e+102) 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 <= -1.65e+63) tmp = 1.0 * x; elseif (z <= 8.5e+102) tmp = (x / (t - z)) * y; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.65e+63], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 8.5e+102], 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 -1.65 \cdot 10^{+63}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+102}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -1.6500000000000001e63 or 8.4999999999999996e102 < z Initial program 71.7%
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 rewrites67.0%
if -1.6500000000000001e63 < z < 8.4999999999999996e102Initial program 92.6%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6472.8
Applied rewrites72.8%
(FPCore (x y z t) :precision binary64 (if (<= z -2.7e-27) (* 1.0 x) (if (<= z 370.0) (* (/ x t) y) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.7e-27) {
tmp = 1.0 * x;
} else if (z <= 370.0) {
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 <= (-2.7d-27)) then
tmp = 1.0d0 * x
else if (z <= 370.0d0) 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 <= -2.7e-27) {
tmp = 1.0 * x;
} else if (z <= 370.0) {
tmp = (x / t) * y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.7e-27: tmp = 1.0 * x elif z <= 370.0: tmp = (x / t) * y else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.7e-27) tmp = Float64(1.0 * x); elseif (z <= 370.0) 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 <= -2.7e-27) tmp = 1.0 * x; elseif (z <= 370.0) tmp = (x / t) * y; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.7e-27], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 370.0], N[(N[(x / t), $MachinePrecision] * y), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{-27}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 370:\\
\;\;\;\;\frac{x}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -2.69999999999999989e-27 or 370 < z Initial program 77.9%
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 rewrites57.4%
if -2.69999999999999989e-27 < z < 370Initial program 92.1%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6464.5
Applied rewrites64.5%
Applied rewrites65.9%
(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 85.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6495.6
Applied rewrites95.6%
Taylor expanded in z around inf
Applied rewrites32.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 2024332
(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)))