
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) (- t x)) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - z) * (t - x)) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * (t - x)) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * (t - x)) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) (- t x)) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - z) * (t - x)) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * (t - x)) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * (t - x)) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * (t - x)) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z y) (- z a))) (t_2 (fma t_1 (- t x) x)))
(if (<= t -1.7e+43)
t_2
(if (<= t 45000.0)
(fma
x
(- (fma -1.0 t_1 (/ z (- z a))) (/ a (- z a)))
(/ (* t (- z y)) (- z a)))
t_2))))double code(double x, double y, double z, double t, double a) {
double t_1 = (z - y) / (z - a);
double t_2 = fma(t_1, (t - x), x);
double tmp;
if (t <= -1.7e+43) {
tmp = t_2;
} else if (t <= 45000.0) {
tmp = fma(x, (fma(-1.0, t_1, (z / (z - a))) - (a / (z - a))), ((t * (z - y)) / (z - a)));
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - y) / Float64(z - a)) t_2 = fma(t_1, Float64(t - x), x) tmp = 0.0 if (t <= -1.7e+43) tmp = t_2; elseif (t <= 45000.0) tmp = fma(x, Float64(fma(-1.0, t_1, Float64(z / Float64(z - a))) - Float64(a / Float64(z - a))), Float64(Float64(t * Float64(z - y)) / Float64(z - a))); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(t - x), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -1.7e+43], t$95$2, If[LessEqual[t, 45000.0], N[(x * N[(N[(-1.0 * t$95$1 + N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_1 := \frac{z - y}{z - a}\\
t_2 := \mathsf{fma}\left(t\_1, t - x, x\right)\\
\mathbf{if}\;t \leq -1.7 \cdot 10^{+43}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 45000:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(-1, t\_1, \frac{z}{z - a}\right) - \frac{a}{z - a}, \frac{t \cdot \left(z - y\right)}{z - a}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if t < -1.7000000000000001e43 or 45000 < t Initial program 67.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6483.7%
Applied rewrites83.7%
if -1.7000000000000001e43 < t < 45000Initial program 67.4%
lift-+.f64N/A
lift-/.f64N/A
frac-2negN/A
add-to-fractionN/A
lower-/.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-*.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6461.9%
Applied rewrites61.9%
Taylor expanded in x around 0
lower-fma.f64N/A
lower--.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6478.7%
Applied rewrites78.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_1 -1e-271)
(fma (/ 1.0 (/ (- z a) (- z y))) (- t x) x)
(if (<= t_1 0.0)
(+ t (* -1.0 (/ (- (* y (- t x)) (* a (- t x))) z)))
(fma (/ (- z y) (- z a)) (- t x) x)))))double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) * (t - x)) / (a - z));
double tmp;
if (t_1 <= -1e-271) {
tmp = fma((1.0 / ((z - a) / (z - y))), (t - x), x);
} else if (t_1 <= 0.0) {
tmp = t + (-1.0 * (((y * (t - x)) - (a * (t - x))) / z));
} else {
tmp = fma(((z - y) / (z - a)), (t - x), x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - z) * Float64(t - x)) / Float64(a - z))) tmp = 0.0 if (t_1 <= -1e-271) tmp = fma(Float64(1.0 / Float64(Float64(z - a) / Float64(z - y))), Float64(t - x), x); elseif (t_1 <= 0.0) tmp = Float64(t + Float64(-1.0 * Float64(Float64(Float64(y * Float64(t - x)) - Float64(a * Float64(t - x))) / z))); else tmp = fma(Float64(Float64(z - y) / Float64(z - a)), Float64(t - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-271], N[(N[(1.0 / N[(N[(z - a), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(t + N[(-1.0 * N[(N[(N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision] - N[(a * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
t_1 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-271}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{\frac{z - a}{z - y}}, t - x, x\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t + -1 \cdot \frac{y \cdot \left(t - x\right) - a \cdot \left(t - x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -9.9999999999999996e-272Initial program 67.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6483.7%
Applied rewrites83.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6483.6%
Applied rewrites83.6%
if -9.9999999999999996e-272 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 67.4%
Taylor expanded in z around -inf
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6445.6%
Applied rewrites45.6%
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 67.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6483.7%
Applied rewrites83.7%
(FPCore (x y z t a) :precision binary64 (if (<= z 4.9e+241) (fma (/ (- z y) (- z a)) (- t x) x) (* (/ (- y z) (- a z)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= 4.9e+241) {
tmp = fma(((z - y) / (z - a)), (t - x), x);
} else {
tmp = ((y - z) / (a - z)) * t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= 4.9e+241) tmp = fma(Float64(Float64(z - y) / Float64(z - a)), Float64(t - x), x); else tmp = Float64(Float64(Float64(y - z) / Float64(a - z)) * t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, 4.9e+241], N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z \leq 4.9 \cdot 10^{+241}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{a - z} \cdot t\\
\end{array}
if z < 4.8999999999999997e241Initial program 67.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6483.7%
Applied rewrites83.7%
if 4.8999999999999997e241 < z Initial program 67.4%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6451.3%
Applied rewrites51.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.3%
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
lift--.f64N/A
lower-/.f6451.3%
Applied rewrites51.3%
(FPCore (x y z t a) :precision binary64 (if (<= z 9.4e+111) (fma (/ (- x t) (- z a)) (- y z) x) (* (/ (- y z) (- a z)) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= 9.4e+111) {
tmp = fma(((x - t) / (z - a)), (y - z), x);
} else {
tmp = ((y - z) / (a - z)) * t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= 9.4e+111) tmp = fma(Float64(Float64(x - t) / Float64(z - a)), Float64(y - z), x); else tmp = Float64(Float64(Float64(y - z) / Float64(a - z)) * t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, 9.4e+111], N[(N[(N[(x - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z \leq 9.4 \cdot 10^{+111}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z - a}, y - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y - z}{a - z} \cdot t\\
\end{array}
if z < 9.4000000000000002e111Initial program 67.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6479.4%
Applied rewrites79.4%
if 9.4000000000000002e111 < z Initial program 67.4%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6451.3%
Applied rewrites51.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.3%
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
lift--.f64N/A
lower-/.f6451.3%
Applied rewrites51.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ x (- z a)) (- y z) x)))
(if (<= x -5.8e+41)
t_1
(if (<= x 235.0) (fma (/ t (- a z)) (- y z) x) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = fma((x / (z - a)), (y - z), x);
double tmp;
if (x <= -5.8e+41) {
tmp = t_1;
} else if (x <= 235.0) {
tmp = fma((t / (a - z)), (y - z), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(x / Float64(z - a)), Float64(y - z), x) tmp = 0.0 if (x <= -5.8e+41) tmp = t_1; elseif (x <= 235.0) tmp = fma(Float64(t / Float64(a - z)), Float64(y - z), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[x, -5.8e+41], t$95$1, If[LessEqual[x, 235.0], N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x}{z - a}, y - z, x\right)\\
\mathbf{if}\;x \leq -5.8 \cdot 10^{+41}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 235:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a - z}, y - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if x < -5.7999999999999998e41 or 235 < x Initial program 67.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6479.4%
Applied rewrites79.4%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f6441.6%
Applied rewrites41.6%
if -5.7999999999999998e41 < x < 235Initial program 67.4%
Taylor expanded in x around 0
Applied rewrites55.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6463.8%
Applied rewrites63.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ x (- z a)) (- y z) x)))
(if (<= x -2.05e+27)
t_1
(if (<= x 235.0) (* (/ (- y z) (- a z)) t) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = fma((x / (z - a)), (y - z), x);
double tmp;
if (x <= -2.05e+27) {
tmp = t_1;
} else if (x <= 235.0) {
tmp = ((y - z) / (a - z)) * t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(x / Float64(z - a)), Float64(y - z), x) tmp = 0.0 if (x <= -2.05e+27) tmp = t_1; elseif (x <= 235.0) tmp = Float64(Float64(Float64(y - z) / Float64(a - z)) * t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[x, -2.05e+27], t$95$1, If[LessEqual[x, 235.0], N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{x}{z - a}, y - z, x\right)\\
\mathbf{if}\;x \leq -2.05 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 235:\\
\;\;\;\;\frac{y - z}{a - z} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if x < -2.0500000000000001e27 or 235 < x Initial program 67.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6479.4%
Applied rewrites79.4%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f6441.6%
Applied rewrites41.6%
if -2.0500000000000001e27 < x < 235Initial program 67.4%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6451.3%
Applied rewrites51.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.3%
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
lift--.f64N/A
lower-/.f6451.3%
Applied rewrites51.3%
(FPCore (x y z t a)
:precision binary64
(if (<= a -4.1e+101)
(fma (/ t a) (- y z) x)
(if (<= a 1.1e-41)
(* (/ (- y z) (- a z)) t)
(fma (/ y a) (- t x) x))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.1e+101) {
tmp = fma((t / a), (y - z), x);
} else if (a <= 1.1e-41) {
tmp = ((y - z) / (a - z)) * t;
} else {
tmp = fma((y / a), (t - x), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.1e+101) tmp = fma(Float64(t / a), Float64(y - z), x); elseif (a <= 1.1e-41) tmp = Float64(Float64(Float64(y - z) / Float64(a - z)) * t); else tmp = fma(Float64(y / a), Float64(t - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.1e+101], N[(N[(t / a), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 1.1e-41], N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;a \leq -4.1 \cdot 10^{+101}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y - z, x\right)\\
\mathbf{elif}\;a \leq 1.1 \cdot 10^{-41}:\\
\;\;\;\;\frac{y - z}{a - z} \cdot t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\
\end{array}
if a < -4.1e101Initial program 67.4%
Taylor expanded in x around 0
Applied rewrites55.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6463.8%
Applied rewrites63.8%
Taylor expanded in z around 0
Applied rewrites44.2%
if -4.1e101 < a < 1.1e-41Initial program 67.4%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6451.3%
Applied rewrites51.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6451.3%
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
lift--.f64N/A
lower-/.f6451.3%
Applied rewrites51.3%
if 1.1e-41 < a Initial program 67.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6483.7%
Applied rewrites83.7%
Taylor expanded in z around 0
lower-/.f6448.7%
Applied rewrites48.7%
(FPCore (x y z t a)
:precision binary64
(if (<= a -106.0)
(fma (/ t a) (- y z) x)
(if (<= a 1.1e-41)
(* t (- (/ y (- a z)) -1.0))
(fma (/ y a) (- t x) x))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -106.0) {
tmp = fma((t / a), (y - z), x);
} else if (a <= 1.1e-41) {
tmp = t * ((y / (a - z)) - -1.0);
} else {
tmp = fma((y / a), (t - x), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -106.0) tmp = fma(Float64(t / a), Float64(y - z), x); elseif (a <= 1.1e-41) tmp = Float64(t * Float64(Float64(y / Float64(a - z)) - -1.0)); else tmp = fma(Float64(y / a), Float64(t - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -106.0], N[(N[(t / a), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 1.1e-41], N[(t * N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;a \leq -106:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y - z, x\right)\\
\mathbf{elif}\;a \leq 1.1 \cdot 10^{-41}:\\
\;\;\;\;t \cdot \left(\frac{y}{a - z} - -1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\
\end{array}
if a < -106Initial program 67.4%
Taylor expanded in x around 0
Applied rewrites55.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6463.8%
Applied rewrites63.8%
Taylor expanded in z around 0
Applied rewrites44.2%
if -106 < a < 1.1e-41Initial program 67.4%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6451.3%
Applied rewrites51.3%
Taylor expanded in z around inf
Applied rewrites41.7%
if 1.1e-41 < a Initial program 67.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6483.7%
Applied rewrites83.7%
Taylor expanded in z around 0
lower-/.f6448.7%
Applied rewrites48.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -1e+124) (* t 1.0) (if (<= z 9e+86) (fma (/ y a) (- t x) x) (* t 1.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1e+124) {
tmp = t * 1.0;
} else if (z <= 9e+86) {
tmp = fma((y / a), (t - x), x);
} else {
tmp = t * 1.0;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1e+124) tmp = Float64(t * 1.0); elseif (z <= 9e+86) tmp = fma(Float64(y / a), Float64(t - x), x); else tmp = Float64(t * 1.0); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1e+124], N[(t * 1.0), $MachinePrecision], If[LessEqual[z, 9e+86], N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], N[(t * 1.0), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+124}:\\
\;\;\;\;t \cdot 1\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot 1\\
\end{array}
if z < -9.9999999999999995e123 or 8.9999999999999999e86 < z Initial program 67.4%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6451.3%
Applied rewrites51.3%
Taylor expanded in z around inf
Applied rewrites41.7%
Taylor expanded in z around 0
Applied rewrites24.5%
Taylor expanded in z around inf
Applied rewrites25.6%
if -9.9999999999999995e123 < z < 8.9999999999999999e86Initial program 67.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6483.7%
Applied rewrites83.7%
Taylor expanded in z around 0
lower-/.f6448.7%
Applied rewrites48.7%
(FPCore (x y z t a)
:precision binary64
(if (<= a -0.00037)
(+ t x)
(if (<= a 1.5e-138)
(/ (* t (- z y)) z)
(if (<= a 1.8e-107) (/ (* x y) (- z a)) (+ t x)))))double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -0.00037) {
tmp = t + x;
} else if (a <= 1.5e-138) {
tmp = (t * (z - y)) / z;
} else if (a <= 1.8e-107) {
tmp = (x * y) / (z - a);
} else {
tmp = t + x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-0.00037d0)) then
tmp = t + x
else if (a <= 1.5d-138) then
tmp = (t * (z - y)) / z
else if (a <= 1.8d-107) then
tmp = (x * y) / (z - a)
else
tmp = t + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -0.00037) {
tmp = t + x;
} else if (a <= 1.5e-138) {
tmp = (t * (z - y)) / z;
} else if (a <= 1.8e-107) {
tmp = (x * y) / (z - a);
} else {
tmp = t + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -0.00037: tmp = t + x elif a <= 1.5e-138: tmp = (t * (z - y)) / z elif a <= 1.8e-107: tmp = (x * y) / (z - a) else: tmp = t + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -0.00037) tmp = Float64(t + x); elseif (a <= 1.5e-138) tmp = Float64(Float64(t * Float64(z - y)) / z); elseif (a <= 1.8e-107) tmp = Float64(Float64(x * y) / Float64(z - a)); else tmp = Float64(t + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -0.00037) tmp = t + x; elseif (a <= 1.5e-138) tmp = (t * (z - y)) / z; elseif (a <= 1.8e-107) tmp = (x * y) / (z - a); else tmp = t + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -0.00037], N[(t + x), $MachinePrecision], If[LessEqual[a, 1.5e-138], N[(N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[a, 1.8e-107], N[(N[(x * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision], N[(t + x), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;a \leq -0.00037:\\
\;\;\;\;t + x\\
\mathbf{elif}\;a \leq 1.5 \cdot 10^{-138}:\\
\;\;\;\;\frac{t \cdot \left(z - y\right)}{z}\\
\mathbf{elif}\;a \leq 1.8 \cdot 10^{-107}:\\
\;\;\;\;\frac{x \cdot y}{z - a}\\
\mathbf{else}:\\
\;\;\;\;t + x\\
\end{array}
if a < -3.6999999999999999e-4 or 1.7999999999999999e-107 < a Initial program 67.4%
Taylor expanded in z around inf
lower--.f6419.6%
Applied rewrites19.6%
Taylor expanded in x around inf
lower-*.f642.8%
Applied rewrites2.8%
lift-+.f64N/A
+-commutativeN/A
lower-+.f642.8%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f642.8%
Applied rewrites2.8%
Taylor expanded in x around 0
Applied rewrites35.2%
if -3.6999999999999999e-4 < a < 1.5e-138Initial program 67.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
mult-flip-revN/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6483.7%
Applied rewrites83.7%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.4%
Applied rewrites39.4%
Taylor expanded in a around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6427.0%
Applied rewrites27.0%
if 1.5e-138 < a < 1.7999999999999999e-107Initial program 67.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6440.8%
Applied rewrites40.8%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
associate-*l/N/A
mult-flipN/A
lower-*.f64N/A
lower-*.f64N/A
lift--.f64N/A
frac-2negN/A
metadata-evalN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6436.7%
Applied rewrites36.7%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6420.6%
Applied rewrites20.6%
(FPCore (x y z t a) :precision binary64 (if (<= y -9.6e+31) (/ (* t y) (- a z)) (if (<= y 1.42e+171) (+ t x) (/ (* x y) (- z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -9.6e+31) {
tmp = (t * y) / (a - z);
} else if (y <= 1.42e+171) {
tmp = t + x;
} else {
tmp = (x * y) / (z - a);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= (-9.6d+31)) then
tmp = (t * y) / (a - z)
else if (y <= 1.42d+171) then
tmp = t + x
else
tmp = (x * y) / (z - a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -9.6e+31) {
tmp = (t * y) / (a - z);
} else if (y <= 1.42e+171) {
tmp = t + x;
} else {
tmp = (x * y) / (z - a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -9.6e+31: tmp = (t * y) / (a - z) elif y <= 1.42e+171: tmp = t + x else: tmp = (x * y) / (z - a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -9.6e+31) tmp = Float64(Float64(t * y) / Float64(a - z)); elseif (y <= 1.42e+171) tmp = Float64(t + x); else tmp = Float64(Float64(x * y) / Float64(z - a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -9.6e+31) tmp = (t * y) / (a - z); elseif (y <= 1.42e+171) tmp = t + x; else tmp = (x * y) / (z - a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -9.6e+31], N[(N[(t * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.42e+171], N[(t + x), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;y \leq -9.6 \cdot 10^{+31}:\\
\;\;\;\;\frac{t \cdot y}{a - z}\\
\mathbf{elif}\;y \leq 1.42 \cdot 10^{+171}:\\
\;\;\;\;t + x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{z - a}\\
\end{array}
if y < -9.5999999999999993e31Initial program 67.4%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6451.3%
Applied rewrites51.3%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6420.8%
Applied rewrites20.8%
if -9.5999999999999993e31 < y < 1.4199999999999999e171Initial program 67.4%
Taylor expanded in z around inf
lower--.f6419.6%
Applied rewrites19.6%
Taylor expanded in x around inf
lower-*.f642.8%
Applied rewrites2.8%
lift-+.f64N/A
+-commutativeN/A
lower-+.f642.8%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f642.8%
Applied rewrites2.8%
Taylor expanded in x around 0
Applied rewrites35.2%
if 1.4199999999999999e171 < y Initial program 67.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6440.8%
Applied rewrites40.8%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
associate-*l/N/A
mult-flipN/A
lower-*.f64N/A
lower-*.f64N/A
lift--.f64N/A
frac-2negN/A
metadata-evalN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lower-/.f6436.7%
Applied rewrites36.7%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6420.6%
Applied rewrites20.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* t y) (- a z)))) (if (<= y -9.6e+31) t_1 (if (<= y 2.4e+170) (+ t x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t * y) / (a - z);
double tmp;
if (y <= -9.6e+31) {
tmp = t_1;
} else if (y <= 2.4e+170) {
tmp = t + x;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (t * y) / (a - z)
if (y <= (-9.6d+31)) then
tmp = t_1
else if (y <= 2.4d+170) then
tmp = t + x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (t * y) / (a - z);
double tmp;
if (y <= -9.6e+31) {
tmp = t_1;
} else if (y <= 2.4e+170) {
tmp = t + x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t * y) / (a - z) tmp = 0 if y <= -9.6e+31: tmp = t_1 elif y <= 2.4e+170: tmp = t + x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t * y) / Float64(a - z)) tmp = 0.0 if (y <= -9.6e+31) tmp = t_1; elseif (y <= 2.4e+170) tmp = Float64(t + x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t * y) / (a - z); tmp = 0.0; if (y <= -9.6e+31) tmp = t_1; elseif (y <= 2.4e+170) tmp = t + x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.6e+31], t$95$1, If[LessEqual[y, 2.4e+170], N[(t + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{t \cdot y}{a - z}\\
\mathbf{if}\;y \leq -9.6 \cdot 10^{+31}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{+170}:\\
\;\;\;\;t + x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if y < -9.5999999999999993e31 or 2.4e170 < y Initial program 67.4%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6451.3%
Applied rewrites51.3%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6420.8%
Applied rewrites20.8%
if -9.5999999999999993e31 < y < 2.4e170Initial program 67.4%
Taylor expanded in z around inf
lower--.f6419.6%
Applied rewrites19.6%
Taylor expanded in x around inf
lower-*.f642.8%
Applied rewrites2.8%
lift-+.f64N/A
+-commutativeN/A
lower-+.f642.8%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f642.8%
Applied rewrites2.8%
Taylor expanded in x around 0
Applied rewrites35.2%
(FPCore (x y z t a) :precision binary64 (if (<= a -0.00039) (+ t x) (if (<= a 3.3e-133) (* t 1.0) (+ t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -0.00039) {
tmp = t + x;
} else if (a <= 3.3e-133) {
tmp = t * 1.0;
} else {
tmp = t + x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-0.00039d0)) then
tmp = t + x
else if (a <= 3.3d-133) then
tmp = t * 1.0d0
else
tmp = t + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -0.00039) {
tmp = t + x;
} else if (a <= 3.3e-133) {
tmp = t * 1.0;
} else {
tmp = t + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -0.00039: tmp = t + x elif a <= 3.3e-133: tmp = t * 1.0 else: tmp = t + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -0.00039) tmp = Float64(t + x); elseif (a <= 3.3e-133) tmp = Float64(t * 1.0); else tmp = Float64(t + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -0.00039) tmp = t + x; elseif (a <= 3.3e-133) tmp = t * 1.0; else tmp = t + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -0.00039], N[(t + x), $MachinePrecision], If[LessEqual[a, 3.3e-133], N[(t * 1.0), $MachinePrecision], N[(t + x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;a \leq -0.00039:\\
\;\;\;\;t + x\\
\mathbf{elif}\;a \leq 3.3 \cdot 10^{-133}:\\
\;\;\;\;t \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t + x\\
\end{array}
if a < -3.8999999999999999e-4 or 3.3000000000000001e-133 < a Initial program 67.4%
Taylor expanded in z around inf
lower--.f6419.6%
Applied rewrites19.6%
Taylor expanded in x around inf
lower-*.f642.8%
Applied rewrites2.8%
lift-+.f64N/A
+-commutativeN/A
lower-+.f642.8%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f642.8%
Applied rewrites2.8%
Taylor expanded in x around 0
Applied rewrites35.2%
if -3.8999999999999999e-4 < a < 3.3000000000000001e-133Initial program 67.4%
Taylor expanded in t around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6451.3%
Applied rewrites51.3%
Taylor expanded in z around inf
Applied rewrites41.7%
Taylor expanded in z around 0
Applied rewrites24.5%
Taylor expanded in z around inf
Applied rewrites25.6%
(FPCore (x y z t a) :precision binary64 (+ t x))
double code(double x, double y, double z, double t, double a) {
return t + x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = t + x
end function
public static double code(double x, double y, double z, double t, double a) {
return t + x;
}
def code(x, y, z, t, a): return t + x
function code(x, y, z, t, a) return Float64(t + x) end
function tmp = code(x, y, z, t, a) tmp = t + x; end
code[x_, y_, z_, t_, a_] := N[(t + x), $MachinePrecision]
t + x
Initial program 67.4%
Taylor expanded in z around inf
lower--.f6419.6%
Applied rewrites19.6%
Taylor expanded in x around inf
lower-*.f642.8%
Applied rewrites2.8%
lift-+.f64N/A
+-commutativeN/A
lower-+.f642.8%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f642.8%
Applied rewrites2.8%
Taylor expanded in x around 0
Applied rewrites35.2%
herbie shell --seed 2025212
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
:precision binary64
(+ x (/ (* (- y z) (- t x)) (- a z))))