
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - 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 + (((y - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - 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 + (((y - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y x) (/ (- z t) (- a t)) x))
(t_2 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (<= t_2 -2e-211)
t_1
(if (<= t_2 2e-231)
(fma
(/ (- (fma a (/ (* (- y x) (- z a)) t) (* (- y x) z)) (* (- y x) a)) t)
-1.0
y)
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - x), ((z - t) / (a - t)), x);
double t_2 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if (t_2 <= -2e-211) {
tmp = t_1;
} else if (t_2 <= 2e-231) {
tmp = fma(((fma(a, (((y - x) * (z - a)) / t), ((y - x) * z)) - ((y - x) * a)) / t), -1.0, y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - x), Float64(Float64(z - t) / Float64(a - t)), x) t_2 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if (t_2 <= -2e-211) tmp = t_1; elseif (t_2 <= 2e-231) tmp = fma(Float64(Float64(fma(a, Float64(Float64(Float64(y - x) * Float64(z - a)) / t), Float64(Float64(y - x) * z)) - Float64(Float64(y - x) * a)) / t), -1.0, y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-211], t$95$1, If[LessEqual[t$95$2, 2e-231], N[(N[(N[(N[(a * N[(N[(N[(y - x), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] - N[(N[(y - x), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] * -1.0 + y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, \frac{z - t}{a - t}, x\right)\\
t_2 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-211}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-231}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(a, \frac{\left(y - x\right) \cdot \left(z - a\right)}{t}, \left(y - x\right) \cdot z\right) - \left(y - x\right) \cdot a}{t}, -1, y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -2.00000000000000017e-211 or 2e-231 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 72.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--.f6490.4
Applied rewrites90.4%
if -2.00000000000000017e-211 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 2e-231Initial program 29.4%
Taylor expanded in t around -inf
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites78.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y x) (/ (- z t) (- a t)) x))
(t_2 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (<= t_2 -2e-211)
t_1
(if (<= t_2 2e-231) (+ y (- (/ (* (- y x) (- z a)) t))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - x), ((z - t) / (a - t)), x);
double t_2 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if (t_2 <= -2e-211) {
tmp = t_1;
} else if (t_2 <= 2e-231) {
tmp = y + -(((y - x) * (z - a)) / t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - x), Float64(Float64(z - t) / Float64(a - t)), x) t_2 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if (t_2 <= -2e-211) tmp = t_1; elseif (t_2 <= 2e-231) tmp = Float64(y + Float64(-Float64(Float64(Float64(y - x) * Float64(z - a)) / t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-211], t$95$1, If[LessEqual[t$95$2, 2e-231], N[(y + (-N[(N[(N[(y - x), $MachinePrecision] * N[(z - a), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision])), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, \frac{z - t}{a - t}, x\right)\\
t_2 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-211}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-231}:\\
\;\;\;\;y + \left(-\frac{\left(y - x\right) \cdot \left(z - a\right)}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -2.00000000000000017e-211 or 2e-231 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 72.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--.f6490.4
Applied rewrites90.4%
if -2.00000000000000017e-211 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 2e-231Initial program 29.4%
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--.f6430.7
Applied rewrites30.7%
Taylor expanded in y around inf
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6430.5
Applied rewrites30.5%
Taylor expanded in t around -inf
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6478.0
Applied rewrites78.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y x) (/ (- z t) (- a t)) x))
(t_2 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (<= t_2 -2e-211) t_1 (if (<= t_2 2e-231) (* y (/ (- t) (- a t))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - x), ((z - t) / (a - t)), x);
double t_2 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if (t_2 <= -2e-211) {
tmp = t_1;
} else if (t_2 <= 2e-231) {
tmp = y * (-t / (a - t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(y - x), Float64(Float64(z - t) / Float64(a - t)), x) t_2 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if (t_2 <= -2e-211) tmp = t_1; elseif (t_2 <= 2e-231) tmp = Float64(y * Float64(Float64(-t) / Float64(a - t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-211], t$95$1, If[LessEqual[t$95$2, 2e-231], N[(y * N[((-t) / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - x, \frac{z - t}{a - t}, x\right)\\
t_2 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-211}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-231}:\\
\;\;\;\;y \cdot \frac{-t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -2.00000000000000017e-211 or 2e-231 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 72.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--.f6490.4
Applied rewrites90.4%
if -2.00000000000000017e-211 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 2e-231Initial program 29.4%
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--.f6430.7
Applied rewrites30.7%
Taylor expanded in y around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6444.3
Applied rewrites44.3%
Taylor expanded in z around 0
mul-1-negN/A
lift-neg.f6441.4
Applied rewrites41.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ (- z t) (- a t)))))
(if (<= t -5.4e+135)
t_1
(if (<= t 4.8e+154) (fma (- y x) (/ z (- a t)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((z - t) / (a - t));
double tmp;
if (t <= -5.4e+135) {
tmp = t_1;
} else if (t <= 4.8e+154) {
tmp = fma((y - x), (z / (a - t)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(z - t) / Float64(a - t))) tmp = 0.0 if (t <= -5.4e+135) tmp = t_1; elseif (t <= 4.8e+154) tmp = fma(Float64(y - x), Float64(z / Float64(a - t)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -5.4e+135], t$95$1, If[LessEqual[t, 4.8e+154], N[(N[(y - x), $MachinePrecision] * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;t \leq -5.4 \cdot 10^{+135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.8 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.3999999999999997e135 or 4.8000000000000003e154 < t Initial program 32.1%
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--.f6466.9
Applied rewrites66.9%
Taylor expanded in y around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6465.6
Applied rewrites65.6%
if -5.3999999999999997e135 < t < 4.8000000000000003e154Initial program 81.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--.f6490.9
Applied rewrites90.9%
Taylor expanded in z around inf
Applied rewrites75.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ (- z t) (- a t)))))
(if (<= t -9.2e+135)
t_1
(if (<= t 1.1e+24) (fma (- y x) (/ (- z t) a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((z - t) / (a - t));
double tmp;
if (t <= -9.2e+135) {
tmp = t_1;
} else if (t <= 1.1e+24) {
tmp = fma((y - x), ((z - t) / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(z - t) / Float64(a - t))) tmp = 0.0 if (t <= -9.2e+135) tmp = t_1; elseif (t <= 1.1e+24) tmp = fma(Float64(y - x), Float64(Float64(z - t) / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -9.2e+135], t$95$1, If[LessEqual[t, 1.1e+24], N[(N[(y - x), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;t \leq -9.2 \cdot 10^{+135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.1 \cdot 10^{+24}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z - t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.2000000000000005e135 or 1.10000000000000001e24 < t Initial program 40.4%
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--.f6471.4
Applied rewrites71.4%
Taylor expanded in y around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6462.5
Applied rewrites62.5%
if -9.2000000000000005e135 < t < 1.10000000000000001e24Initial program 85.1%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6471.3
Applied rewrites71.3%
(FPCore (x y z t a)
:precision binary64
(if (<= t -9e+151)
y
(if (<= t -4.2e-21)
(+ x y)
(if (<= t 4e-236) (* y (/ z a)) (if (<= t 2.7e+25) x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -9e+151) {
tmp = y;
} else if (t <= -4.2e-21) {
tmp = x + y;
} else if (t <= 4e-236) {
tmp = y * (z / a);
} else if (t <= 2.7e+25) {
tmp = x;
} else {
tmp = y;
}
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 (t <= (-9d+151)) then
tmp = y
else if (t <= (-4.2d-21)) then
tmp = x + y
else if (t <= 4d-236) then
tmp = y * (z / a)
else if (t <= 2.7d+25) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -9e+151) {
tmp = y;
} else if (t <= -4.2e-21) {
tmp = x + y;
} else if (t <= 4e-236) {
tmp = y * (z / a);
} else if (t <= 2.7e+25) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -9e+151: tmp = y elif t <= -4.2e-21: tmp = x + y elif t <= 4e-236: tmp = y * (z / a) elif t <= 2.7e+25: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -9e+151) tmp = y; elseif (t <= -4.2e-21) tmp = Float64(x + y); elseif (t <= 4e-236) tmp = Float64(y * Float64(z / a)); elseif (t <= 2.7e+25) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -9e+151) tmp = y; elseif (t <= -4.2e-21) tmp = x + y; elseif (t <= 4e-236) tmp = y * (z / a); elseif (t <= 2.7e+25) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -9e+151], y, If[LessEqual[t, -4.2e-21], N[(x + y), $MachinePrecision], If[LessEqual[t, 4e-236], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.7e+25], x, y]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{+151}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq -4.2 \cdot 10^{-21}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 4 \cdot 10^{-236}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{+25}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -8.9999999999999997e151 or 2.7e25 < t Initial program 40.0%
Taylor expanded in t around inf
Applied rewrites47.5%
if -8.9999999999999997e151 < t < -4.20000000000000025e-21Initial program 65.8%
Taylor expanded in t around inf
lift--.f6421.5
Applied rewrites21.5%
Taylor expanded in x around 0
Applied rewrites34.9%
if -4.20000000000000025e-21 < t < 4.0000000000000002e-236Initial program 90.6%
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--.f6495.3
Applied rewrites95.3%
Taylor expanded in y around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6442.7
Applied rewrites42.7%
Taylor expanded in t around 0
lower-/.f6430.9
Applied rewrites30.9%
if 4.0000000000000002e-236 < t < 2.7e25Initial program 87.8%
Taylor expanded in a around inf
Applied rewrites33.7%
(FPCore (x y z t a)
:precision binary64
(if (<= t -6.6e+88)
y
(if (<= t -3.4e-187)
x
(if (<= t 3e-236) (/ (* y z) a) (if (<= t 2.7e+25) x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6.6e+88) {
tmp = y;
} else if (t <= -3.4e-187) {
tmp = x;
} else if (t <= 3e-236) {
tmp = (y * z) / a;
} else if (t <= 2.7e+25) {
tmp = x;
} else {
tmp = y;
}
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 (t <= (-6.6d+88)) then
tmp = y
else if (t <= (-3.4d-187)) then
tmp = x
else if (t <= 3d-236) then
tmp = (y * z) / a
else if (t <= 2.7d+25) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6.6e+88) {
tmp = y;
} else if (t <= -3.4e-187) {
tmp = x;
} else if (t <= 3e-236) {
tmp = (y * z) / a;
} else if (t <= 2.7e+25) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -6.6e+88: tmp = y elif t <= -3.4e-187: tmp = x elif t <= 3e-236: tmp = (y * z) / a elif t <= 2.7e+25: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -6.6e+88) tmp = y; elseif (t <= -3.4e-187) tmp = x; elseif (t <= 3e-236) tmp = Float64(Float64(y * z) / a); elseif (t <= 2.7e+25) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -6.6e+88) tmp = y; elseif (t <= -3.4e-187) tmp = x; elseif (t <= 3e-236) tmp = (y * z) / a; elseif (t <= 2.7e+25) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -6.6e+88], y, If[LessEqual[t, -3.4e-187], x, If[LessEqual[t, 3e-236], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[t, 2.7e+25], x, y]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.6 \cdot 10^{+88}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq -3.4 \cdot 10^{-187}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 3 \cdot 10^{-236}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{+25}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -6.6000000000000006e88 or 2.7e25 < t Initial program 41.3%
Taylor expanded in t around inf
Applied rewrites45.7%
if -6.6000000000000006e88 < t < -3.4000000000000001e-187 or 3.00000000000000014e-236 < t < 2.7e25Initial program 85.7%
Taylor expanded in a around inf
Applied rewrites31.7%
if -3.4000000000000001e-187 < t < 3.00000000000000014e-236Initial program 92.2%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift--.f6437.3
Applied rewrites37.3%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6433.3
Applied rewrites33.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* y (/ (- z t) (- a t))))) (if (<= t -3.4e+20) t_1 (if (<= t 7.6e+23) (fma (- y x) (/ z a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((z - t) / (a - t));
double tmp;
if (t <= -3.4e+20) {
tmp = t_1;
} else if (t <= 7.6e+23) {
tmp = fma((y - x), (z / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(z - t) / Float64(a - t))) tmp = 0.0 if (t <= -3.4e+20) tmp = t_1; elseif (t <= 7.6e+23) tmp = fma(Float64(y - x), Float64(z / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.4e+20], t$95$1, If[LessEqual[t, 7.6e+23], N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;t \leq -3.4 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7.6 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.4e20 or 7.5999999999999995e23 < t Initial program 44.6%
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--.f6473.7
Applied rewrites73.7%
Taylor expanded in y around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6461.0
Applied rewrites61.0%
if -3.4e20 < t < 7.5999999999999995e23Initial program 89.1%
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--.f6494.1
Applied rewrites94.1%
Taylor expanded in t around 0
lower-/.f6472.3
Applied rewrites72.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* y (/ (- z t) (- t))))) (if (<= t -9.2e+135) t_1 (if (<= t 2.7e+25) (fma (- y x) (/ z a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((z - t) / -t);
double tmp;
if (t <= -9.2e+135) {
tmp = t_1;
} else if (t <= 2.7e+25) {
tmp = fma((y - x), (z / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(z - t) / Float64(-t))) tmp = 0.0 if (t <= -9.2e+135) tmp = t_1; elseif (t <= 2.7e+25) tmp = fma(Float64(y - x), Float64(z / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - t), $MachinePrecision] / (-t)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -9.2e+135], t$95$1, If[LessEqual[t, 2.7e+25], N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - t}{-t}\\
\mathbf{if}\;t \leq -9.2 \cdot 10^{+135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.2000000000000005e135 or 2.7e25 < t Initial program 40.3%
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--.f6471.4
Applied rewrites71.4%
Taylor expanded in y around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6462.5
Applied rewrites62.5%
Taylor expanded in t around inf
mul-1-negN/A
lift-neg.f6455.2
Applied rewrites55.2%
if -9.2000000000000005e135 < t < 2.7e25Initial program 85.1%
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--.f6492.4
Applied rewrites92.4%
Taylor expanded in t around 0
lower-/.f6466.6
Applied rewrites66.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* y (/ (- t) (- a t))))) (if (<= t -5.4e+135) t_1 (if (<= t 4e+144) (fma (- y x) (/ z a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (-t / (a - t));
double tmp;
if (t <= -5.4e+135) {
tmp = t_1;
} else if (t <= 4e+144) {
tmp = fma((y - x), (z / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(-t) / Float64(a - t))) tmp = 0.0 if (t <= -5.4e+135) tmp = t_1; elseif (t <= 4e+144) tmp = fma(Float64(y - x), Float64(z / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[((-t) / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -5.4e+135], t$95$1, If[LessEqual[t, 4e+144], N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{-t}{a - t}\\
\mathbf{if}\;t \leq -5.4 \cdot 10^{+135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4 \cdot 10^{+144}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.3999999999999997e135 or 4.00000000000000009e144 < t Initial program 32.6%
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--.f6467.1
Applied rewrites67.1%
Taylor expanded in y around inf
sub-divN/A
lower-*.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6465.4
Applied rewrites65.4%
Taylor expanded in z around 0
mul-1-negN/A
lift-neg.f6457.6
Applied rewrites57.6%
if -5.3999999999999997e135 < t < 4.00000000000000009e144Initial program 81.9%
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--.f6491.2
Applied rewrites91.2%
Taylor expanded in t around 0
lower-/.f6462.1
Applied rewrites62.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.5e+136) y (if (<= t 5e+144) (fma (- y x) (/ z a) x) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.5e+136) {
tmp = y;
} else if (t <= 5e+144) {
tmp = fma((y - x), (z / a), x);
} else {
tmp = y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.5e+136) tmp = y; elseif (t <= 5e+144) tmp = fma(Float64(y - x), Float64(z / a), x); else tmp = y; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.5e+136], y, If[LessEqual[t, 5e+144], N[(N[(y - x), $MachinePrecision] * N[(z / a), $MachinePrecision] + x), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.5 \cdot 10^{+136}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+144}:\\
\;\;\;\;\mathsf{fma}\left(y - x, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -1.49999999999999989e136 or 4.9999999999999999e144 < t Initial program 32.6%
Taylor expanded in t around inf
Applied rewrites53.1%
if -1.49999999999999989e136 < t < 4.9999999999999999e144Initial program 81.9%
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--.f6491.2
Applied rewrites91.2%
Taylor expanded in t around 0
lower-/.f6462.1
Applied rewrites62.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.1e+136) y (if (<= t 5e+144) (fma z (/ (- y x) a) x) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.1e+136) {
tmp = y;
} else if (t <= 5e+144) {
tmp = fma(z, ((y - x) / a), x);
} else {
tmp = y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.1e+136) tmp = y; elseif (t <= 5e+144) tmp = fma(z, Float64(Float64(y - x) / a), x); else tmp = y; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.1e+136], y, If[LessEqual[t, 5e+144], N[(z * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{+136}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+144}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -1.1e136 or 4.9999999999999999e144 < t Initial program 32.6%
Taylor expanded in t around inf
Applied rewrites53.1%
if -1.1e136 < t < 4.9999999999999999e144Initial program 81.9%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f6460.4
Applied rewrites60.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.6e+136) y (if (<= t 4e+144) (fma y (/ z a) x) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.6e+136) {
tmp = y;
} else if (t <= 4e+144) {
tmp = fma(y, (z / a), x);
} else {
tmp = y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.6e+136) tmp = y; elseif (t <= 4e+144) tmp = fma(y, Float64(z / a), x); else tmp = y; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.6e+136], y, If[LessEqual[t, 4e+144], N[(y * N[(z / a), $MachinePrecision] + x), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{+136}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 4 \cdot 10^{+144}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -1.59999999999999994e136 or 4.00000000000000009e144 < t Initial program 32.6%
Taylor expanded in t around inf
Applied rewrites53.1%
if -1.59999999999999994e136 < t < 4.00000000000000009e144Initial program 81.9%
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--.f6491.2
Applied rewrites91.2%
Taylor expanded in t around 0
lower-/.f6462.1
Applied rewrites62.1%
Taylor expanded in x around 0
Applied rewrites52.2%
(FPCore (x y z t a) :precision binary64 (if (<= t -6.6e+88) y (if (<= t 2.7e+25) x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6.6e+88) {
tmp = y;
} else if (t <= 2.7e+25) {
tmp = x;
} else {
tmp = y;
}
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 (t <= (-6.6d+88)) then
tmp = y
else if (t <= 2.7d+25) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6.6e+88) {
tmp = y;
} else if (t <= 2.7e+25) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -6.6e+88: tmp = y elif t <= 2.7e+25: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -6.6e+88) tmp = y; elseif (t <= 2.7e+25) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -6.6e+88) tmp = y; elseif (t <= 2.7e+25) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -6.6e+88], y, If[LessEqual[t, 2.7e+25], x, y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.6 \cdot 10^{+88}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{+25}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -6.6000000000000006e88 or 2.7e25 < t Initial program 41.3%
Taylor expanded in t around inf
Applied rewrites45.7%
if -6.6000000000000006e88 < t < 2.7e25Initial program 87.4%
Taylor expanded in a around inf
Applied rewrites33.8%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 68.6%
Taylor expanded in a around inf
Applied rewrites25.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ (- y x) 1.0) (/ (- z t) (- a t))))))
(if (< a -1.6153062845442575e-142)
t_1
(if (< a 3.774403170083174e-182) (- y (* (/ z t) (- y x))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - x));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (((y - x) / 1.0d0) * ((z - t) / (a - t)))
if (a < (-1.6153062845442575d-142)) then
tmp = t_1
else if (a < 3.774403170083174d-182) then
tmp = y - ((z / t) * (y - x))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - x));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))) tmp = 0 if a < -1.6153062845442575e-142: tmp = t_1 elif a < 3.774403170083174e-182: tmp = y - ((z / t) * (y - x)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - x) / 1.0) * Float64(Float64(z - t) / Float64(a - t)))) tmp = 0.0 if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = Float64(y - Float64(Float64(z / t) * Float64(y - x))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))); tmp = 0.0; if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = y - ((z / t) * (y - x)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] / 1.0), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[a, -1.6153062845442575e-142], t$95$1, If[Less[a, 3.774403170083174e-182], N[(y - N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;a < -1.6153062845442575 \cdot 10^{-142}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a < 3.774403170083174 \cdot 10^{-182}:\\
\;\;\;\;y - \frac{z}{t} \cdot \left(y - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2025093
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (if (< a -646122513817703/4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))) (if (< a 1887201585041587/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))))))
(+ x (/ (* (- y x) (- z t)) (- a t))))