
(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]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
Herbie found 15 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]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (* (- x) (/ (- a y) z)) t)))
(if (<= z -1.1e+203)
t_1
(if (<= z 1.35e+95) (fma (- y z) (/ (- t x) (- a z)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (-x * ((a - y) / z)) + t;
double tmp;
if (z <= -1.1e+203) {
tmp = t_1;
} else if (z <= 1.35e+95) {
tmp = fma((y - z), ((t - x) / (a - z)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(-x) * Float64(Float64(a - y) / z)) + t) tmp = 0.0 if (z <= -1.1e+203) tmp = t_1; elseif (z <= 1.35e+95) tmp = fma(Float64(y - z), Float64(Float64(t - x) / Float64(a - z)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[((-x) * N[(N[(a - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -1.1e+203], t$95$1, If[LessEqual[z, 1.35e+95], N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-x\right) \cdot \frac{a - y}{z} + t\\
\mathbf{if}\;z \leq -1.1 \cdot 10^{+203}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+95}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.10000000000000002e203 or 1.35e95 < z Initial program 32.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites64.1%
Taylor expanded in x around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6478.6
Applied rewrites78.6%
if -1.10000000000000002e203 < z < 1.35e95Initial program 80.5%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6487.5
Applied rewrites87.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (* (- x) (/ (- a y) z)) t)))
(if (<= z -1.12e+170)
t_1
(if (<= z -4e-140)
(fma (- y z) (/ t (- a z)) x)
(if (<= z 4.2e-75)
(fma (- t x) (/ (- y z) a) x)
(if (<= z 4.5e+111) (+ (- (/ (* (- t x) (- y a)) z)) t) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (-x * ((a - y) / z)) + t;
double tmp;
if (z <= -1.12e+170) {
tmp = t_1;
} else if (z <= -4e-140) {
tmp = fma((y - z), (t / (a - z)), x);
} else if (z <= 4.2e-75) {
tmp = fma((t - x), ((y - z) / a), x);
} else if (z <= 4.5e+111) {
tmp = -(((t - x) * (y - a)) / z) + t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(-x) * Float64(Float64(a - y) / z)) + t) tmp = 0.0 if (z <= -1.12e+170) tmp = t_1; elseif (z <= -4e-140) tmp = fma(Float64(y - z), Float64(t / Float64(a - z)), x); elseif (z <= 4.2e-75) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); elseif (z <= 4.5e+111) tmp = Float64(Float64(-Float64(Float64(Float64(t - x) * Float64(y - 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[(N[(a - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -1.12e+170], t$95$1, If[LessEqual[z, -4e-140], N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 4.2e-75], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 4.5e+111], N[((-N[(N[(N[(t - x), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]) + t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-x\right) \cdot \frac{a - y}{z} + t\\
\mathbf{if}\;z \leq -1.12 \cdot 10^{+170}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4 \cdot 10^{-140}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t}{a - z}, x\right)\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-75}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+111}:\\
\;\;\;\;\left(-\frac{\left(t - x\right) \cdot \left(y - a\right)}{z}\right) + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.1200000000000001e170 or 4.50000000000000001e111 < z Initial program 31.5%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites64.1%
Taylor expanded in x around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6478.9
Applied rewrites78.9%
if -1.1200000000000001e170 < z < -3.9999999999999999e-140Initial program 73.8%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6485.0
Applied rewrites85.0%
Taylor expanded in x around 0
Applied rewrites66.6%
if -3.9999999999999999e-140 < z < 4.2000000000000002e-75Initial program 91.2%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6485.1
Applied rewrites85.1%
if 4.2000000000000002e-75 < z < 4.50000000000000001e111Initial program 74.2%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites52.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (* (- x) (/ (- a y) z)) t)))
(if (<= z -1.12e+170)
t_1
(if (<= z -4e-140)
(fma (- y z) (/ t (- a z)) x)
(if (<= z 3.6e-24)
(fma (- t x) (/ (- y z) a) x)
(if (<= z 1.35e+203) (- t (* (/ (- t x) z) y)) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (-x * ((a - y) / z)) + t;
double tmp;
if (z <= -1.12e+170) {
tmp = t_1;
} else if (z <= -4e-140) {
tmp = fma((y - z), (t / (a - z)), x);
} else if (z <= 3.6e-24) {
tmp = fma((t - x), ((y - z) / a), x);
} else if (z <= 1.35e+203) {
tmp = t - (((t - x) / z) * y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(-x) * Float64(Float64(a - y) / z)) + t) tmp = 0.0 if (z <= -1.12e+170) tmp = t_1; elseif (z <= -4e-140) tmp = fma(Float64(y - z), Float64(t / Float64(a - z)), x); elseif (z <= 3.6e-24) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); elseif (z <= 1.35e+203) tmp = Float64(t - Float64(Float64(Float64(t - x) / z) * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[((-x) * N[(N[(a - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -1.12e+170], t$95$1, If[LessEqual[z, -4e-140], N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 3.6e-24], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.35e+203], N[(t - N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-x\right) \cdot \frac{a - y}{z} + t\\
\mathbf{if}\;z \leq -1.12 \cdot 10^{+170}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4 \cdot 10^{-140}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t}{a - z}, x\right)\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-24}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+203}:\\
\;\;\;\;t - \frac{t - x}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.1200000000000001e170 or 1.35e203 < z Initial program 27.5%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites64.9%
Taylor expanded in x around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6484.0
Applied rewrites84.0%
if -1.1200000000000001e170 < z < -3.9999999999999999e-140Initial program 73.8%
lift-+.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
+-commutativeN/A
associate-/l*N/A
sub-divN/A
lower-fma.f64N/A
lift--.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6485.0
Applied rewrites85.0%
Taylor expanded in x around 0
Applied rewrites66.6%
if -3.9999999999999999e-140 < z < 3.6000000000000001e-24Initial program 90.7%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6482.8
Applied rewrites82.8%
if 3.6000000000000001e-24 < z < 1.35e203Initial program 58.4%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites58.0%
Taylor expanded in a around 0
lower--.f64N/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6458.9
Applied rewrites58.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* (/ (- t x) z) y))))
(if (<= z -1.1e+33)
t_1
(if (<= z 3.6e-24)
(fma (- t x) (/ (- y z) a) x)
(if (<= z 1.35e+203) t_1 (+ (* (- x) (/ (- a y) z)) t))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (((t - x) / z) * y);
double tmp;
if (z <= -1.1e+33) {
tmp = t_1;
} else if (z <= 3.6e-24) {
tmp = fma((t - x), ((y - z) / a), x);
} else if (z <= 1.35e+203) {
tmp = t_1;
} else {
tmp = (-x * ((a - y) / z)) + t;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t - Float64(Float64(Float64(t - x) / z) * y)) tmp = 0.0 if (z <= -1.1e+33) tmp = t_1; elseif (z <= 3.6e-24) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); elseif (z <= 1.35e+203) tmp = t_1; else tmp = Float64(Float64(Float64(-x) * Float64(Float64(a - y) / z)) + t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.1e+33], t$95$1, If[LessEqual[z, 3.6e-24], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.35e+203], t$95$1, N[(N[((-x) * N[(N[(a - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - \frac{t - x}{z} \cdot y\\
\mathbf{if}\;z \leq -1.1 \cdot 10^{+33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-24}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+203}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(-x\right) \cdot \frac{a - y}{z} + t\\
\end{array}
\end{array}
if z < -1.09999999999999997e33 or 3.6000000000000001e-24 < z < 1.35e203Initial program 51.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites60.3%
Taylor expanded in a around 0
lower--.f64N/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6464.3
Applied rewrites64.3%
if -1.09999999999999997e33 < z < 3.6000000000000001e-24Initial program 89.3%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6478.1
Applied rewrites78.1%
if 1.35e203 < z Initial program 51.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites60.3%
Taylor expanded in x around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6462.6
Applied rewrites62.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* (/ (- t x) z) y))))
(if (<= z -7.6e+32)
t_1
(if (<= z 4.2e-75)
(fma y (/ (- t x) a) x)
(if (<= z 1.35e+203) t_1 (+ (* (- x) (/ (- a y) z)) t))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (((t - x) / z) * y);
double tmp;
if (z <= -7.6e+32) {
tmp = t_1;
} else if (z <= 4.2e-75) {
tmp = fma(y, ((t - x) / a), x);
} else if (z <= 1.35e+203) {
tmp = t_1;
} else {
tmp = (-x * ((a - y) / z)) + t;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t - Float64(Float64(Float64(t - x) / z) * y)) tmp = 0.0 if (z <= -7.6e+32) tmp = t_1; elseif (z <= 4.2e-75) tmp = fma(y, Float64(Float64(t - x) / a), x); elseif (z <= 1.35e+203) tmp = t_1; else tmp = Float64(Float64(Float64(-x) * Float64(Float64(a - y) / z)) + t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.6e+32], t$95$1, If[LessEqual[z, 4.2e-75], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.35e+203], t$95$1, N[(N[((-x) * N[(N[(a - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - \frac{t - x}{z} \cdot y\\
\mathbf{if}\;z \leq -7.6 \cdot 10^{+32}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-75}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+203}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(-x\right) \cdot \frac{a - y}{z} + t\\
\end{array}
\end{array}
if z < -7.6000000000000006e32 or 4.2000000000000002e-75 < z < 1.35e203Initial program 54.4%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites58.9%
Taylor expanded in a around 0
lower--.f64N/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6461.8
Applied rewrites61.8%
if -7.6000000000000006e32 < z < 4.2000000000000002e-75Initial program 89.6%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6473.8
Applied rewrites73.8%
if 1.35e203 < z Initial program 54.4%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites58.9%
Taylor expanded in x around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6459.8
Applied rewrites59.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (- t (* (/ (- t x) z) y)))) (if (<= z -7.6e+32) t_1 (if (<= z 4.2e-75) (fma y (/ (- t x) a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (((t - x) / z) * y);
double tmp;
if (z <= -7.6e+32) {
tmp = t_1;
} else if (z <= 4.2e-75) {
tmp = fma(y, ((t - x) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(t - Float64(Float64(Float64(t - x) / z) * y)) tmp = 0.0 if (z <= -7.6e+32) tmp = t_1; elseif (z <= 4.2e-75) tmp = fma(y, Float64(Float64(t - x) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.6e+32], t$95$1, If[LessEqual[z, 4.2e-75], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - \frac{t - x}{z} \cdot y\\
\mathbf{if}\;z \leq -7.6 \cdot 10^{+32}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-75}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.6000000000000006e32 or 4.2000000000000002e-75 < z Initial program 50.0%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.7%
Taylor expanded in a around 0
lower--.f64N/A
associate-/l*N/A
sub-divN/A
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lift--.f6464.5
Applied rewrites64.5%
if -7.6000000000000006e32 < z < 4.2000000000000002e-75Initial program 89.6%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6473.8
Applied rewrites73.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (* x (/ y z)) t)))
(if (<= z -1.2e+33)
t_1
(if (<= z 4.2e-75)
(fma y (/ (- t x) a) x)
(if (<= z 2.9e+93) (* (/ (- x t) z) y) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * (y / z)) + t;
double tmp;
if (z <= -1.2e+33) {
tmp = t_1;
} else if (z <= 4.2e-75) {
tmp = fma(y, ((t - x) / a), x);
} else if (z <= 2.9e+93) {
tmp = ((x - t) / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(x * Float64(y / z)) + t) tmp = 0.0 if (z <= -1.2e+33) tmp = t_1; elseif (z <= 4.2e-75) tmp = fma(y, Float64(Float64(t - x) / a), x); elseif (z <= 2.9e+93) tmp = Float64(Float64(Float64(x - t) / z) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -1.2e+33], t$95$1, If[LessEqual[z, 4.2e-75], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.9e+93], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{z} + t\\
\mathbf{if}\;z \leq -1.2 \cdot 10^{+33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-75}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t - x}{a}, x\right)\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+93}:\\
\;\;\;\;\frac{x - t}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.2e33 or 2.8999999999999998e93 < z Initial program 40.9%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites62.6%
Taylor expanded in x around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6471.3
Applied rewrites71.3%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f6463.2
Applied rewrites63.2%
if -1.2e33 < z < 4.2000000000000002e-75Initial program 89.6%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6473.8
Applied rewrites73.8%
if 4.2000000000000002e-75 < z < 2.8999999999999998e93Initial program 76.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites51.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6431.9
Applied rewrites31.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (* x (/ y z)) t)))
(if (<= z -1.2e+33)
t_1
(if (<= z 4.2e-75)
(fma t (/ y a) x)
(if (<= z 2.9e+93) (* (/ (- x t) z) y) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * (y / z)) + t;
double tmp;
if (z <= -1.2e+33) {
tmp = t_1;
} else if (z <= 4.2e-75) {
tmp = fma(t, (y / a), x);
} else if (z <= 2.9e+93) {
tmp = ((x - t) / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(x * Float64(y / z)) + t) tmp = 0.0 if (z <= -1.2e+33) tmp = t_1; elseif (z <= 4.2e-75) tmp = fma(t, Float64(y / a), x); elseif (z <= 2.9e+93) tmp = Float64(Float64(Float64(x - t) / z) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -1.2e+33], t$95$1, If[LessEqual[z, 4.2e-75], N[(t * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.9e+93], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{z} + t\\
\mathbf{if}\;z \leq -1.2 \cdot 10^{+33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-75}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y}{a}, x\right)\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+93}:\\
\;\;\;\;\frac{x - t}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.2e33 or 2.8999999999999998e93 < z Initial program 40.9%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites62.6%
Taylor expanded in x around -inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6471.3
Applied rewrites71.3%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f6463.2
Applied rewrites63.2%
if -1.2e33 < z < 4.2000000000000002e-75Initial program 89.6%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6473.8
Applied rewrites73.8%
lift-fma.f64N/A
lift--.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f6475.9
Applied rewrites75.9%
Taylor expanded in x around 0
Applied rewrites62.9%
if 4.2000000000000002e-75 < z < 2.8999999999999998e93Initial program 76.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites51.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6431.9
Applied rewrites31.9%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.3e+35)
t
(if (<= z 4.2e-75)
(fma t (/ y a) x)
(if (<= z 5e+93) (* (/ (- x t) z) y) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.3e+35) {
tmp = t;
} else if (z <= 4.2e-75) {
tmp = fma(t, (y / a), x);
} else if (z <= 5e+93) {
tmp = ((x - t) / z) * y;
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.3e+35) tmp = t; elseif (z <= 4.2e-75) tmp = fma(t, Float64(y / a), x); elseif (z <= 5e+93) tmp = Float64(Float64(Float64(x - t) / z) * y); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.3e+35], t, If[LessEqual[z, 4.2e-75], N[(t * N[(y / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 5e+93], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+35}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-75}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y}{a}, x\right)\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+93}:\\
\;\;\;\;\frac{x - t}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -2.2999999999999998e35 or 5.0000000000000001e93 < z Initial program 40.7%
Taylor expanded in z around inf
Applied rewrites47.7%
if -2.2999999999999998e35 < z < 4.2000000000000002e-75Initial program 89.6%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6473.6
Applied rewrites73.6%
lift-fma.f64N/A
lift--.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f6475.6
Applied rewrites75.6%
Taylor expanded in x around 0
Applied rewrites62.7%
if 4.2000000000000002e-75 < z < 5.0000000000000001e93Initial program 76.0%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites51.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6431.9
Applied rewrites31.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.3e+35) t (if (<= z 4.3e+83) (fma t (/ y a) x) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.3e+35) {
tmp = t;
} else if (z <= 4.3e+83) {
tmp = fma(t, (y / a), x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.3e+35) tmp = t; elseif (z <= 4.3e+83) tmp = fma(t, Float64(y / a), x); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.3e+35], t, If[LessEqual[z, 4.3e+83], N[(t * N[(y / a), $MachinePrecision] + x), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+35}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -2.2999999999999998e35 or 4.3e83 < z Initial program 40.9%
Taylor expanded in z around inf
Applied rewrites47.2%
if -2.2999999999999998e35 < z < 4.3e83Initial program 87.0%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6467.6
Applied rewrites67.6%
lift-fma.f64N/A
lift--.f64N/A
lift-/.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f6469.4
Applied rewrites69.4%
Taylor expanded in x around 0
Applied rewrites57.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.3e+35) t (if (<= z 4e+83) (fma y (/ t a) x) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.3e+35) {
tmp = t;
} else if (z <= 4e+83) {
tmp = fma(y, (t / a), x);
} else {
tmp = t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.3e+35) tmp = t; elseif (z <= 4e+83) tmp = fma(y, Float64(t / a), x); else tmp = t; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.3e+35], t, If[LessEqual[z, 4e+83], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+35}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -2.2999999999999998e35 or 4.00000000000000012e83 < z Initial program 40.9%
Taylor expanded in z around inf
Applied rewrites47.2%
if -2.2999999999999998e35 < z < 4.00000000000000012e83Initial program 87.0%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6467.6
Applied rewrites67.6%
Taylor expanded in x around 0
Applied rewrites56.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.3e+35) t (if (<= z 2.6e-148) x (if (<= z 7.5e+79) (* (/ x z) y) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.3e+35) {
tmp = t;
} else if (z <= 2.6e-148) {
tmp = x;
} else if (z <= 7.5e+79) {
tmp = (x / z) * y;
} else {
tmp = t;
}
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 (z <= (-2.3d+35)) then
tmp = t
else if (z <= 2.6d-148) then
tmp = x
else if (z <= 7.5d+79) then
tmp = (x / z) * y
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.3e+35) {
tmp = t;
} else if (z <= 2.6e-148) {
tmp = x;
} else if (z <= 7.5e+79) {
tmp = (x / z) * y;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.3e+35: tmp = t elif z <= 2.6e-148: tmp = x elif z <= 7.5e+79: tmp = (x / z) * y else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.3e+35) tmp = t; elseif (z <= 2.6e-148) tmp = x; elseif (z <= 7.5e+79) tmp = Float64(Float64(x / z) * y); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.3e+35) tmp = t; elseif (z <= 2.6e-148) tmp = x; elseif (z <= 7.5e+79) tmp = (x / z) * y; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.3e+35], t, If[LessEqual[z, 2.6e-148], x, If[LessEqual[z, 7.5e+79], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+35}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-148}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+79}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -2.2999999999999998e35 or 7.49999999999999967e79 < z Initial program 41.0%
Taylor expanded in z around inf
Applied rewrites47.0%
if -2.2999999999999998e35 < z < 2.60000000000000008e-148Initial program 89.7%
Taylor expanded in a around inf
Applied rewrites34.6%
if 2.60000000000000008e-148 < z < 7.49999999999999967e79Initial program 81.4%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites44.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6428.7
Applied rewrites28.7%
Taylor expanded in x around inf
Applied rewrites17.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.3e+35) t (if (<= z 2.6e-148) x (if (<= z 7.5e+79) (/ (* x y) z) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.3e+35) {
tmp = t;
} else if (z <= 2.6e-148) {
tmp = x;
} else if (z <= 7.5e+79) {
tmp = (x * y) / z;
} else {
tmp = t;
}
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 (z <= (-2.3d+35)) then
tmp = t
else if (z <= 2.6d-148) then
tmp = x
else if (z <= 7.5d+79) then
tmp = (x * y) / z
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.3e+35) {
tmp = t;
} else if (z <= 2.6e-148) {
tmp = x;
} else if (z <= 7.5e+79) {
tmp = (x * y) / z;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.3e+35: tmp = t elif z <= 2.6e-148: tmp = x elif z <= 7.5e+79: tmp = (x * y) / z else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.3e+35) tmp = t; elseif (z <= 2.6e-148) tmp = x; elseif (z <= 7.5e+79) tmp = Float64(Float64(x * y) / z); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.3e+35) tmp = t; elseif (z <= 2.6e-148) tmp = x; elseif (z <= 7.5e+79) tmp = (x * y) / z; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.3e+35], t, If[LessEqual[z, 2.6e-148], x, If[LessEqual[z, 7.5e+79], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+35}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-148}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+79}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -2.2999999999999998e35 or 7.49999999999999967e79 < z Initial program 41.0%
Taylor expanded in z around inf
Applied rewrites47.0%
if -2.2999999999999998e35 < z < 2.60000000000000008e-148Initial program 89.7%
Taylor expanded in a around inf
Applied rewrites34.6%
if 2.60000000000000008e-148 < z < 7.49999999999999967e79Initial program 81.4%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites44.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6428.7
Applied rewrites28.7%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6418.5
Applied rewrites18.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.3e+35) t (if (<= z 22000000000000.0) x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.3e+35) {
tmp = t;
} else if (z <= 22000000000000.0) {
tmp = x;
} else {
tmp = t;
}
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 (z <= (-2.3d+35)) then
tmp = t
else if (z <= 22000000000000.0d0) then
tmp = x
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.3e+35) {
tmp = t;
} else if (z <= 22000000000000.0) {
tmp = x;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.3e+35: tmp = t elif z <= 22000000000000.0: tmp = x else: tmp = t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.3e+35) tmp = t; elseif (z <= 22000000000000.0) tmp = x; else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.3e+35) tmp = t; elseif (z <= 22000000000000.0) tmp = x; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.3e+35], t, If[LessEqual[z, 22000000000000.0], x, t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+35}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq 22000000000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if z < -2.2999999999999998e35 or 2.2e13 < z Initial program 44.7%
Taylor expanded in z around inf
Applied rewrites44.4%
if -2.2999999999999998e35 < z < 2.2e13Initial program 89.0%
Taylor expanded in a around inf
Applied rewrites33.6%
(FPCore (x y z t a) :precision binary64 t)
double code(double x, double y, double z, double t, double a) {
return t;
}
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
end function
public static double code(double x, double y, double z, double t, double a) {
return t;
}
def code(x, y, z, t, a): return t
function code(x, y, z, t, a) return t end
function tmp = code(x, y, z, t, a) tmp = t; end
code[x_, y_, z_, t_, a_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 68.5%
Taylor expanded in z around inf
Applied rewrites25.1%
herbie shell --seed 2025120
(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))))