
(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 13 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 (/ y (- a z))))
(if (<= t -4.2e+85)
(fma (/ z (- z a)) (- t x) (fma t_1 (- t x) x))
(if (<= t 3.1e+55)
(fma -1.0 (/ (* t (- z y)) (- a z)) (* x (- (/ a (- a z)) t_1)))
(fma (/ (- z y) (- z a)) (- t x) x)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y / (a - z);
double tmp;
if (t <= -4.2e+85) {
tmp = fma((z / (z - a)), (t - x), fma(t_1, (t - x), x));
} else if (t <= 3.1e+55) {
tmp = fma(-1.0, ((t * (z - y)) / (a - z)), (x * ((a / (a - z)) - t_1)));
} else {
tmp = fma(((z - y) / (z - a)), (t - x), x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y / Float64(a - z)) tmp = 0.0 if (t <= -4.2e+85) tmp = fma(Float64(z / Float64(z - a)), Float64(t - x), fma(t_1, Float64(t - x), x)); elseif (t <= 3.1e+55) tmp = fma(-1.0, Float64(Float64(t * Float64(z - y)) / Float64(a - z)), Float64(x * Float64(Float64(a / Float64(a - z)) - t_1))); 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[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4.2e+85], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + N[(t$95$1 * N[(t - x), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.1e+55], N[(-1.0 * N[(N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + N[(x * N[(N[(a / N[(a - z), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a - z}\\
\mathbf{if}\;t \leq -4.2 \cdot 10^{+85}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, t - x, \mathsf{fma}\left(t\_1, t - x, x\right)\right)\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{+55}:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{t \cdot \left(z - y\right)}{a - z}, x \cdot \left(\frac{a}{a - z} - t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\
\end{array}
\end{array}
if t < -4.2000000000000002e85Initial program 69.2%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
mult-flipN/A
associate-*r/N/A
*-rgt-identityN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
div-addN/A
remove-double-negN/A
associate-+l+N/A
Applied rewrites84.9%
if -4.2000000000000002e85 < t < 3.09999999999999994e55Initial program 69.2%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lower-/.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6463.6
Applied rewrites63.6%
Taylor expanded in x around 0
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--.f6482.8
Applied rewrites82.8%
if 3.09999999999999994e55 < t Initial program 69.2%
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--.f6484.8
Applied rewrites84.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_1 -5e+60)
(fma (* (/ 1.0 (- a z)) (- t x)) (- y z) x)
(if (<= t_1 0.0)
(/ (fma -1.0 (* t (- z y)) (* x (- a y))) (- a z))
(fma (/ z (- z a)) (- t x) (fma (/ y (- a z)) (- 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 <= -5e+60) {
tmp = fma(((1.0 / (a - z)) * (t - x)), (y - z), x);
} else if (t_1 <= 0.0) {
tmp = fma(-1.0, (t * (z - y)), (x * (a - y))) / (a - z);
} else {
tmp = fma((z / (z - a)), (t - x), fma((y / (a - z)), (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 <= -5e+60) tmp = fma(Float64(Float64(1.0 / Float64(a - z)) * Float64(t - x)), Float64(y - z), x); elseif (t_1 <= 0.0) tmp = Float64(fma(-1.0, Float64(t * Float64(z - y)), Float64(x * Float64(a - y))) / Float64(a - z)); else tmp = fma(Float64(z / Float64(z - a)), Float64(t - x), fma(Float64(y / Float64(a - z)), 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, -5e+60], N[(N[(N[(1.0 / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(-1.0 * N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision] + N[(x * N[(a - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], N[(N[(z / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+60}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{a - z} \cdot \left(t - x\right), y - z, x\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, t \cdot \left(z - y\right), x \cdot \left(a - y\right)\right)}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{z - a}, t - x, \mathsf{fma}\left(\frac{y}{a - z}, t - x, x\right)\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -4.99999999999999975e60Initial program 69.2%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/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--.f6480.5
Applied rewrites80.5%
lift-/.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift--.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
metadata-eval80.4
Applied rewrites80.4%
if -4.99999999999999975e60 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 69.2%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lower-/.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6463.6
Applied rewrites63.6%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6474.6
Applied rewrites74.6%
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 69.2%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
mult-flipN/A
associate-*r/N/A
*-rgt-identityN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
div-addN/A
remove-double-negN/A
associate-+l+N/A
Applied rewrites84.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y z) (- t x)) (- a z)))))
(if (<= t_1 -5e+60)
(fma (* (/ 1.0 (- a z)) (- t x)) (- y z) x)
(if (<= t_1 0.0)
(/ (fma -1.0 (* t (- z y)) (* x (- a y))) (- a 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 <= -5e+60) {
tmp = fma(((1.0 / (a - z)) * (t - x)), (y - z), x);
} else if (t_1 <= 0.0) {
tmp = fma(-1.0, (t * (z - y)), (x * (a - y))) / (a - 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 <= -5e+60) tmp = fma(Float64(Float64(1.0 / Float64(a - z)) * Float64(t - x)), Float64(y - z), x); elseif (t_1 <= 0.0) tmp = Float64(fma(-1.0, Float64(t * Float64(z - y)), Float64(x * Float64(a - y))) / Float64(a - 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, -5e+60], N[(N[(N[(1.0 / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(-1.0 * N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision] + N[(x * N[(a - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+60}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{a - z} \cdot \left(t - x\right), y - z, x\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, t \cdot \left(z - y\right), x \cdot \left(a - y\right)\right)}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -4.99999999999999975e60Initial program 69.2%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/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--.f6480.5
Applied rewrites80.5%
lift-/.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift--.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
metadata-eval80.4
Applied rewrites80.4%
if -4.99999999999999975e60 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0Initial program 69.2%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
lower-/.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6463.6
Applied rewrites63.6%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f6474.6
Applied rewrites74.6%
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) Initial program 69.2%
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--.f6484.8
Applied rewrites84.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- x t) (/ y z) t)))
(if (<= z -8e+168)
t_1
(if (<= z 4.5e+163) (fma (/ (- x t) (- z a)) (- y z) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((x - t), (y / z), t);
double tmp;
if (z <= -8e+168) {
tmp = t_1;
} else if (z <= 4.5e+163) {
tmp = fma(((x - t) / (z - a)), (y - z), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(x - t), Float64(y / z), t) tmp = 0.0 if (z <= -8e+168) tmp = t_1; elseif (z <= 4.5e+163) tmp = fma(Float64(Float64(x - t) / Float64(z - a)), 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 - t), $MachinePrecision] * N[(y / z), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -8e+168], t$95$1, If[LessEqual[z, 4.5e+163], N[(N[(N[(x - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x - t, \frac{y}{z}, t\right)\\
\mathbf{if}\;z \leq -8 \cdot 10^{+168}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+163}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z - a}, y - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.9999999999999995e168 or 4.49999999999999988e163 < z Initial program 69.2%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
mult-flipN/A
associate-*r/N/A
*-rgt-identityN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
div-addN/A
remove-double-negN/A
associate-+l+N/A
Applied rewrites84.9%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6444.7
Applied rewrites44.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
mul-1-negN/A
sub-negate-revN/A
lift--.f64N/A
lower-fma.f64N/A
mult-flip-revN/A
lower-/.f6449.1
Applied rewrites49.1%
if -7.9999999999999995e168 < z < 4.49999999999999988e163Initial program 69.2%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/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--.f6480.5
Applied rewrites80.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.05e+183) (fma (- x t) (/ y z) t) (fma (/ (- z y) (- z a)) (- t x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.05e+183) {
tmp = fma((x - t), (y / z), t);
} else {
tmp = fma(((z - y) / (z - a)), (t - x), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.05e+183) tmp = fma(Float64(x - t), Float64(y / z), t); else tmp = fma(Float64(Float64(z - y) / Float64(z - a)), Float64(t - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.05e+183], N[(N[(x - t), $MachinePrecision] * N[(y / z), $MachinePrecision] + t), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+183}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{z - a}, t - x, x\right)\\
\end{array}
\end{array}
if z < -1.05e183Initial program 69.2%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
mult-flipN/A
associate-*r/N/A
*-rgt-identityN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
div-addN/A
remove-double-negN/A
associate-+l+N/A
Applied rewrites84.9%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6444.7
Applied rewrites44.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
mul-1-negN/A
sub-negate-revN/A
lift--.f64N/A
lower-fma.f64N/A
mult-flip-revN/A
lower-/.f6449.1
Applied rewrites49.1%
if -1.05e183 < z Initial program 69.2%
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--.f6484.8
Applied rewrites84.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- x t) (/ y z) t)))
(if (<= z -1.2e+23)
t_1
(if (<= z 2.7e+30) (fma (/ (- x t) a) (- z y) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((x - t), (y / z), t);
double tmp;
if (z <= -1.2e+23) {
tmp = t_1;
} else if (z <= 2.7e+30) {
tmp = fma(((x - t) / a), (z - y), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(x - t), Float64(y / z), t) tmp = 0.0 if (z <= -1.2e+23) tmp = t_1; elseif (z <= 2.7e+30) tmp = fma(Float64(Float64(x - t) / a), Float64(z - y), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - t), $MachinePrecision] * N[(y / z), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -1.2e+23], t$95$1, If[LessEqual[z, 2.7e+30], N[(N[(N[(x - t), $MachinePrecision] / a), $MachinePrecision] * N[(z - y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x - t, \frac{y}{z}, t\right)\\
\mathbf{if}\;z \leq -1.2 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+30}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{a}, z - y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.2e23 or 2.6999999999999999e30 < z Initial program 69.2%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
mult-flipN/A
associate-*r/N/A
*-rgt-identityN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
div-addN/A
remove-double-negN/A
associate-+l+N/A
Applied rewrites84.9%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6444.7
Applied rewrites44.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
mul-1-negN/A
sub-negate-revN/A
lift--.f64N/A
lower-fma.f64N/A
mult-flip-revN/A
lower-/.f6449.1
Applied rewrites49.1%
if -1.2e23 < z < 2.6999999999999999e30Initial program 69.2%
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--.f6484.8
Applied rewrites84.8%
lift--.f64N/A
lift-fma.f64N/A
add-flipN/A
sub-flipN/A
lift-/.f64N/A
associate-*l/N/A
frac-2negN/A
distribute-rgt-neg-outN/A
sub-negate-revN/A
lift--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
mult-flipN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
remove-double-negN/A
lower-fma.f64N/A
Applied rewrites80.4%
Taylor expanded in z around 0
lower-/.f64N/A
lower--.f6451.8
Applied rewrites51.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (- x t) (/ y z) t))) (if (<= z -1e+22) t_1 (if (<= z 0.0098) (fma (/ y a) (- t x) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((x - t), (y / z), t);
double tmp;
if (z <= -1e+22) {
tmp = t_1;
} else if (z <= 0.0098) {
tmp = fma((y / a), (t - x), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(x - t), Float64(y / z), t) tmp = 0.0 if (z <= -1e+22) tmp = t_1; elseif (z <= 0.0098) tmp = fma(Float64(y / a), Float64(t - x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - t), $MachinePrecision] * N[(y / z), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -1e+22], t$95$1, If[LessEqual[z, 0.0098], N[(N[(y / a), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x - t, \frac{y}{z}, t\right)\\
\mathbf{if}\;z \leq -1 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.0098:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1e22 or 0.0097999999999999997 < z Initial program 69.2%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
mult-flipN/A
associate-*r/N/A
*-rgt-identityN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
div-addN/A
remove-double-negN/A
associate-+l+N/A
Applied rewrites84.9%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6444.7
Applied rewrites44.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
mul-1-negN/A
sub-negate-revN/A
lift--.f64N/A
lower-fma.f64N/A
mult-flip-revN/A
lower-/.f6449.1
Applied rewrites49.1%
if -1e22 < z < 0.0097999999999999997Initial program 69.2%
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--.f6484.8
Applied rewrites84.8%
Taylor expanded in z around 0
lower-/.f6448.8
Applied rewrites48.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (- x t) (/ y z) t))) (if (<= z -9e-32) t_1 (if (<= z 6.5e-31) (* y (/ (- t x) a)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((x - t), (y / z), t);
double tmp;
if (z <= -9e-32) {
tmp = t_1;
} else if (z <= 6.5e-31) {
tmp = y * ((t - x) / a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(x - t), Float64(y / z), t) tmp = 0.0 if (z <= -9e-32) tmp = t_1; elseif (z <= 6.5e-31) tmp = Float64(y * Float64(Float64(t - x) / a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - t), $MachinePrecision] * N[(y / z), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[z, -9e-32], t$95$1, If[LessEqual[z, 6.5e-31], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x - t, \frac{y}{z}, t\right)\\
\mathbf{if}\;z \leq -9 \cdot 10^{-32}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-31}:\\
\;\;\;\;y \cdot \frac{t - x}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.00000000000000009e-32 or 6.49999999999999967e-31 < z Initial program 69.2%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
mult-flipN/A
associate-*r/N/A
*-rgt-identityN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
div-addN/A
remove-double-negN/A
associate-+l+N/A
Applied rewrites84.9%
Taylor expanded in a around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower--.f6444.7
Applied rewrites44.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
mul-1-negN/A
sub-negate-revN/A
lift--.f64N/A
lower-fma.f64N/A
mult-flip-revN/A
lower-/.f6449.1
Applied rewrites49.1%
if -9.00000000000000009e-32 < z < 6.49999999999999967e-31Initial program 69.2%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6441.5
Applied rewrites41.5%
Taylor expanded in a around inf
lower-/.f64N/A
lower--.f6425.8
Applied rewrites25.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.4e-28) (+ x t) (if (<= z 5.1e-20) (* y (/ (- t x) a)) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.4e-28) {
tmp = x + t;
} else if (z <= 5.1e-20) {
tmp = y * ((t - x) / a);
} else {
tmp = x + 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 <= (-1.4d-28)) then
tmp = x + t
else if (z <= 5.1d-20) then
tmp = y * ((t - x) / a)
else
tmp = x + 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 <= -1.4e-28) {
tmp = x + t;
} else if (z <= 5.1e-20) {
tmp = y * ((t - x) / a);
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.4e-28: tmp = x + t elif z <= 5.1e-20: tmp = y * ((t - x) / a) else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.4e-28) tmp = Float64(x + t); elseif (z <= 5.1e-20) tmp = Float64(y * Float64(Float64(t - x) / a)); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.4e-28) tmp = x + t; elseif (z <= 5.1e-20) tmp = y * ((t - x) / a); else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.4e-28], N[(x + t), $MachinePrecision], If[LessEqual[z, 5.1e-20], N[(y * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{-28}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 5.1 \cdot 10^{-20}:\\
\;\;\;\;y \cdot \frac{t - x}{a}\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -1.3999999999999999e-28 or 5.10000000000000019e-20 < z Initial program 69.2%
Taylor expanded in z around inf
lower--.f6419.8
Applied rewrites19.8%
Taylor expanded in x around 0
Applied rewrites33.7%
if -1.3999999999999999e-28 < z < 5.10000000000000019e-20Initial program 69.2%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6441.5
Applied rewrites41.5%
Taylor expanded in a around inf
lower-/.f64N/A
lower--.f6425.8
Applied rewrites25.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.4e-28) (+ x t) (if (<= z 5.5e-20) (* y (/ t (- a z))) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.4e-28) {
tmp = x + t;
} else if (z <= 5.5e-20) {
tmp = y * (t / (a - z));
} else {
tmp = x + 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 <= (-1.4d-28)) then
tmp = x + t
else if (z <= 5.5d-20) then
tmp = y * (t / (a - z))
else
tmp = x + 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 <= -1.4e-28) {
tmp = x + t;
} else if (z <= 5.5e-20) {
tmp = y * (t / (a - z));
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.4e-28: tmp = x + t elif z <= 5.5e-20: tmp = y * (t / (a - z)) else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.4e-28) tmp = Float64(x + t); elseif (z <= 5.5e-20) tmp = Float64(y * Float64(t / Float64(a - z))); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.4e-28) tmp = x + t; elseif (z <= 5.5e-20) tmp = y * (t / (a - z)); else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.4e-28], N[(x + t), $MachinePrecision], If[LessEqual[z, 5.5e-20], N[(y * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{-28}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-20}:\\
\;\;\;\;y \cdot \frac{t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -1.3999999999999999e-28 or 5.4999999999999996e-20 < z Initial program 69.2%
Taylor expanded in z around inf
lower--.f6419.8
Applied rewrites19.8%
Taylor expanded in x around 0
Applied rewrites33.7%
if -1.3999999999999999e-28 < z < 5.4999999999999996e-20Initial program 69.2%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6441.5
Applied rewrites41.5%
Taylor expanded in x around 0
lower-/.f64N/A
lower--.f6423.1
Applied rewrites23.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -1e-138) (+ x t) (if (<= z 5.1e-20) (/ (* t y) (- a z)) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1e-138) {
tmp = x + t;
} else if (z <= 5.1e-20) {
tmp = (t * y) / (a - z);
} else {
tmp = x + 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 <= (-1d-138)) then
tmp = x + t
else if (z <= 5.1d-20) then
tmp = (t * y) / (a - z)
else
tmp = x + 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 <= -1e-138) {
tmp = x + t;
} else if (z <= 5.1e-20) {
tmp = (t * y) / (a - z);
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1e-138: tmp = x + t elif z <= 5.1e-20: tmp = (t * y) / (a - z) else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1e-138) tmp = Float64(x + t); elseif (z <= 5.1e-20) tmp = Float64(Float64(t * y) / Float64(a - z)); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1e-138) tmp = x + t; elseif (z <= 5.1e-20) tmp = (t * y) / (a - z); else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1e-138], N[(x + t), $MachinePrecision], If[LessEqual[z, 5.1e-20], N[(N[(t * y), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-138}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 5.1 \cdot 10^{-20}:\\
\;\;\;\;\frac{t \cdot y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -1.00000000000000007e-138 or 5.10000000000000019e-20 < z Initial program 69.2%
Taylor expanded in z around inf
lower--.f6419.8
Applied rewrites19.8%
Taylor expanded in x around 0
Applied rewrites33.7%
if -1.00000000000000007e-138 < z < 5.10000000000000019e-20Initial program 69.2%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.8
Applied rewrites39.8%
Taylor expanded in y around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6421.3
Applied rewrites21.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -8.5e-178) (+ x t) (if (<= z 5.5e-167) (/ (* t y) a) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8.5e-178) {
tmp = x + t;
} else if (z <= 5.5e-167) {
tmp = (t * y) / a;
} else {
tmp = x + 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 <= (-8.5d-178)) then
tmp = x + t
else if (z <= 5.5d-167) then
tmp = (t * y) / a
else
tmp = x + 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 <= -8.5e-178) {
tmp = x + t;
} else if (z <= 5.5e-167) {
tmp = (t * y) / a;
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -8.5e-178: tmp = x + t elif z <= 5.5e-167: tmp = (t * y) / a else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -8.5e-178) tmp = Float64(x + t); elseif (z <= 5.5e-167) tmp = Float64(Float64(t * y) / a); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -8.5e-178) tmp = x + t; elseif (z <= 5.5e-167) tmp = (t * y) / a; else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -8.5e-178], N[(x + t), $MachinePrecision], If[LessEqual[z, 5.5e-167], N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{-178}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-167}:\\
\;\;\;\;\frac{t \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -8.5000000000000001e-178 or 5.5000000000000003e-167 < z Initial program 69.2%
Taylor expanded in z around inf
lower--.f6419.8
Applied rewrites19.8%
Taylor expanded in x around 0
Applied rewrites33.7%
if -8.5000000000000001e-178 < z < 5.5000000000000003e-167Initial program 69.2%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6439.8
Applied rewrites39.8%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6416.6
Applied rewrites16.6%
(FPCore (x y z t a) :precision binary64 (+ x t))
double code(double x, double y, double z, double t, double a) {
return x + 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 = x + t
end function
public static double code(double x, double y, double z, double t, double a) {
return x + t;
}
def code(x, y, z, t, a): return x + t
function code(x, y, z, t, a) return Float64(x + t) end
function tmp = code(x, y, z, t, a) tmp = x + t; end
code[x_, y_, z_, t_, a_] := N[(x + t), $MachinePrecision]
\begin{array}{l}
\\
x + t
\end{array}
Initial program 69.2%
Taylor expanded in z around inf
lower--.f6419.8
Applied rewrites19.8%
Taylor expanded in x around 0
Applied rewrites33.7%
herbie shell --seed 2025149
(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))))