
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (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 * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \frac{y \cdot \left(z - t\right)}{a - t}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (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 * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + \frac{y \cdot \left(z - t\right)}{a - t}
(FPCore (x y z t a) :precision binary64 (fma (/ (- t z) (- t a)) y x))
double code(double x, double y, double z, double t, double a) {
return fma(((t - z) / (t - a)), y, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(t - z) / Float64(t - a)), y, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(t - z), $MachinePrecision] / N[(t - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]
\mathsf{fma}\left(\frac{t - z}{t - a}, y, x\right)
Initial program 85.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/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--.f6498.0%
Applied rewrites98.0%
(FPCore (x y z t a) :precision binary64 (fma (/ y (- t a)) (- t z) x))
double code(double x, double y, double z, double t, double a) {
return fma((y / (t - a)), (t - z), x);
}
function code(x, y, z, t, a) return fma(Float64(y / Float64(t - a)), Float64(t - z), x) end
code[x_, y_, z_, t_, a_] := N[(N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision] * N[(t - z), $MachinePrecision] + x), $MachinePrecision]
\mathsf{fma}\left(\frac{y}{t - a}, t - z, x\right)
Initial program 85.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
associate-/l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lower--.f6495.7%
Applied rewrites95.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ t (- t a)) y x)))
(if (<= t -1.15e+87)
t_1
(if (<= t 5.2e-21) (+ x (/ (* y z) (- a t))) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t / (t - a)), y, x);
double tmp;
if (t <= -1.15e+87) {
tmp = t_1;
} else if (t <= 5.2e-21) {
tmp = x + ((y * z) / (a - t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t / Float64(t - a)), y, x) tmp = 0.0 if (t <= -1.15e+87) tmp = t_1; elseif (t <= 5.2e-21) tmp = Float64(x + Float64(Float64(y * z) / Float64(a - t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t / N[(t - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[t, -1.15e+87], t$95$1, If[LessEqual[t, 5.2e-21], N[(x + N[(N[(y * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t}{t - a}, y, x\right)\\
\mathbf{if}\;t \leq -1.15 \cdot 10^{+87}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{-21}:\\
\;\;\;\;x + \frac{y \cdot z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -1.1500000000000001e87 or 5.2000000000000003e-21 < t Initial program 85.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/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--.f6498.0%
Applied rewrites98.0%
Taylor expanded in z around 0
Applied rewrites71.1%
if -1.1500000000000001e87 < t < 5.2000000000000003e-21Initial program 85.3%
Taylor expanded in z around inf
lower-*.f6473.4%
Applied rewrites73.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -3e-61) (fma (/ (- t z) t) y x) (if (<= t 9e-21) (fma (- z t) (/ y a) x) (fma (/ t (- t a)) y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3e-61) {
tmp = fma(((t - z) / t), y, x);
} else if (t <= 9e-21) {
tmp = fma((z - t), (y / a), x);
} else {
tmp = fma((t / (t - a)), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3e-61) tmp = fma(Float64(Float64(t - z) / t), y, x); elseif (t <= 9e-21) tmp = fma(Float64(z - t), Float64(y / a), x); else tmp = fma(Float64(t / Float64(t - a)), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3e-61], N[(N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t, 9e-21], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(t / N[(t - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq -3 \cdot 10^{-61}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{t}, y, x\right)\\
\mathbf{elif}\;t \leq 9 \cdot 10^{-21}:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{t - a}, y, x\right)\\
\end{array}
if t < -3.0000000000000001e-61Initial program 85.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/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--.f6498.0%
Applied rewrites98.0%
Taylor expanded in z around 0
Applied rewrites71.1%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6467.2%
Applied rewrites67.2%
if -3.0000000000000001e-61 < t < 8.9999999999999994e-21Initial program 85.3%
Taylor expanded in t around 0
Applied rewrites57.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-fma.f64N/A
mult-flip-revN/A
lower-/.f6461.2%
Applied rewrites61.2%
if 8.9999999999999994e-21 < t Initial program 85.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/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--.f6498.0%
Applied rewrites98.0%
Taylor expanded in z around 0
Applied rewrites71.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -27000000000.0) (fma (/ (- t z) t) y x) (if (<= t 5.5e-21) (fma (/ z a) y x) (fma (/ t (- t a)) y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -27000000000.0) {
tmp = fma(((t - z) / t), y, x);
} else if (t <= 5.5e-21) {
tmp = fma((z / a), y, x);
} else {
tmp = fma((t / (t - a)), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -27000000000.0) tmp = fma(Float64(Float64(t - z) / t), y, x); elseif (t <= 5.5e-21) tmp = fma(Float64(z / a), y, x); else tmp = fma(Float64(t / Float64(t - a)), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -27000000000.0], N[(N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t, 5.5e-21], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(t / N[(t - a), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq -27000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{t}, y, x\right)\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{-21}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{t - a}, y, x\right)\\
\end{array}
if t < -2.7e10Initial program 85.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/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--.f6498.0%
Applied rewrites98.0%
Taylor expanded in z around 0
Applied rewrites71.1%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6467.2%
Applied rewrites67.2%
if -2.7e10 < t < 5.4999999999999998e-21Initial program 85.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/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--.f6498.0%
Applied rewrites98.0%
Taylor expanded in z around 0
Applied rewrites71.1%
Taylor expanded in t around 0
lower-/.f6461.9%
Applied rewrites61.9%
if 5.4999999999999998e-21 < t Initial program 85.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/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--.f6498.0%
Applied rewrites98.0%
Taylor expanded in z around 0
Applied rewrites71.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -27000000000.0) (fma (/ (- t z) t) y x) (if (<= t 5.5e-21) (fma (/ z a) y x) (fma (/ y (- t a)) t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -27000000000.0) {
tmp = fma(((t - z) / t), y, x);
} else if (t <= 5.5e-21) {
tmp = fma((z / a), y, x);
} else {
tmp = fma((y / (t - a)), t, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -27000000000.0) tmp = fma(Float64(Float64(t - z) / t), y, x); elseif (t <= 5.5e-21) tmp = fma(Float64(z / a), y, x); else tmp = fma(Float64(y / Float64(t - a)), t, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -27000000000.0], N[(N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision] * y + x), $MachinePrecision], If[LessEqual[t, 5.5e-21], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq -27000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - z}{t}, y, x\right)\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{-21}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t - a}, t, x\right)\\
\end{array}
if t < -2.7e10Initial program 85.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/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--.f6498.0%
Applied rewrites98.0%
Taylor expanded in z around 0
Applied rewrites71.1%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6467.2%
Applied rewrites67.2%
if -2.7e10 < t < 5.4999999999999998e-21Initial program 85.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/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--.f6498.0%
Applied rewrites98.0%
Taylor expanded in z around 0
Applied rewrites71.1%
Taylor expanded in t around 0
lower-/.f6461.9%
Applied rewrites61.9%
if 5.4999999999999998e-21 < t Initial program 85.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/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--.f6498.0%
Applied rewrites98.0%
Taylor expanded in z around 0
Applied rewrites71.1%
lift-fma.f64N/A
add-flipN/A
sub-flipN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f6469.9%
Applied rewrites69.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- t z) t) y x)))
(if (<= t -27000000000.0)
t_1
(if (<= t 2.4e-18) (fma (/ z a) y x) t_1))))double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((t - z) / t), y, x);
double tmp;
if (t <= -27000000000.0) {
tmp = t_1;
} else if (t <= 2.4e-18) {
tmp = fma((z / a), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(t - z) / t), y, x) tmp = 0.0 if (t <= -27000000000.0) tmp = t_1; elseif (t <= 2.4e-18) tmp = fma(Float64(z / a), y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[t, -27000000000.0], t$95$1, If[LessEqual[t, 2.4e-18], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t - z}{t}, y, x\right)\\
\mathbf{if}\;t \leq -27000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.4 \cdot 10^{-18}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -2.7e10 or 2.3999999999999999e-18 < t Initial program 85.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/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--.f6498.0%
Applied rewrites98.0%
Taylor expanded in z around 0
Applied rewrites71.1%
Taylor expanded in a around 0
lower-/.f64N/A
lower--.f6467.2%
Applied rewrites67.2%
if -2.7e10 < t < 2.3999999999999999e-18Initial program 85.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/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--.f6498.0%
Applied rewrites98.0%
Taylor expanded in z around 0
Applied rewrites71.1%
Taylor expanded in t around 0
lower-/.f6461.9%
Applied rewrites61.9%
(FPCore (x y z t a) :precision binary64 (if (<= t -3.7e+92) (+ x y) (if (<= t 3.6e-19) (fma (/ z a) y x) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.7e+92) {
tmp = x + y;
} else if (t <= 3.6e-19) {
tmp = fma((z / a), y, x);
} else {
tmp = x + y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.7e+92) tmp = Float64(x + y); elseif (t <= 3.6e-19) tmp = fma(Float64(z / a), y, x); else tmp = Float64(x + y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.7e+92], N[(x + y), $MachinePrecision], If[LessEqual[t, 3.6e-19], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq -3.7 \cdot 10^{+92}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 3.6 \cdot 10^{-19}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
if t < -3.7e92 or 3.6000000000000001e-19 < t Initial program 85.3%
Taylor expanded in t around inf
lower-+.f6460.6%
Applied rewrites60.6%
if -3.7e92 < t < 3.6000000000000001e-19Initial program 85.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/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--.f6498.0%
Applied rewrites98.0%
Taylor expanded in z around 0
Applied rewrites71.1%
Taylor expanded in t around 0
lower-/.f6461.9%
Applied rewrites61.9%
(FPCore (x y z t a) :precision binary64 (if (<= t 8.8e-272) (+ x y) (if (<= t 2.3e-50) (* (/ y a) z) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 8.8e-272) {
tmp = x + y;
} else if (t <= 2.3e-50) {
tmp = (y / a) * z;
} else {
tmp = x + 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 <= 8.8d-272) then
tmp = x + y
else if (t <= 2.3d-50) then
tmp = (y / a) * z
else
tmp = x + 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 <= 8.8e-272) {
tmp = x + y;
} else if (t <= 2.3e-50) {
tmp = (y / a) * z;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 8.8e-272: tmp = x + y elif t <= 2.3e-50: tmp = (y / a) * z else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 8.8e-272) tmp = Float64(x + y); elseif (t <= 2.3e-50) tmp = Float64(Float64(y / a) * z); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 8.8e-272) tmp = x + y; elseif (t <= 2.3e-50) tmp = (y / a) * z; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 8.8e-272], N[(x + y), $MachinePrecision], If[LessEqual[t, 2.3e-50], N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq 8.8 \cdot 10^{-272}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 2.3 \cdot 10^{-50}:\\
\;\;\;\;\frac{y}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
if t < 8.7999999999999995e-272 or 2.3000000000000002e-50 < t Initial program 85.3%
Taylor expanded in t around inf
lower-+.f6460.6%
Applied rewrites60.6%
if 8.7999999999999995e-272 < t < 2.3000000000000002e-50Initial program 85.3%
Taylor expanded in t around inf
lower-+.f6460.6%
Applied rewrites60.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.8%
Applied rewrites26.8%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6429.1%
Applied rewrites29.1%
Taylor expanded in t around 0
Applied rewrites20.3%
(FPCore (x y z t a) :precision binary64 (if (<= t 8.8e-272) (+ x y) (if (<= t 2.3e-50) (* (/ z a) y) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 8.8e-272) {
tmp = x + y;
} else if (t <= 2.3e-50) {
tmp = (z / a) * y;
} else {
tmp = x + 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 <= 8.8d-272) then
tmp = x + y
else if (t <= 2.3d-50) then
tmp = (z / a) * y
else
tmp = x + 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 <= 8.8e-272) {
tmp = x + y;
} else if (t <= 2.3e-50) {
tmp = (z / a) * y;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= 8.8e-272: tmp = x + y elif t <= 2.3e-50: tmp = (z / a) * y else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= 8.8e-272) tmp = Float64(x + y); elseif (t <= 2.3e-50) tmp = Float64(Float64(z / a) * y); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= 8.8e-272) tmp = x + y; elseif (t <= 2.3e-50) tmp = (z / a) * y; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, 8.8e-272], N[(x + y), $MachinePrecision], If[LessEqual[t, 2.3e-50], N[(N[(z / a), $MachinePrecision] * y), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq 8.8 \cdot 10^{-272}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 2.3 \cdot 10^{-50}:\\
\;\;\;\;\frac{z}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
if t < 8.7999999999999995e-272 or 2.3000000000000002e-50 < t Initial program 85.3%
Taylor expanded in t around inf
lower-+.f6460.6%
Applied rewrites60.6%
if 8.7999999999999995e-272 < t < 2.3000000000000002e-50Initial program 85.3%
Taylor expanded in t around inf
lower-+.f6460.6%
Applied rewrites60.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6426.8%
Applied rewrites26.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f6418.8%
Applied rewrites18.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6420.4%
Applied rewrites20.4%
(FPCore (x y z t a) :precision binary64 (+ x y))
double code(double x, double y, double z, double t, double a) {
return x + y;
}
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
end function
public static double code(double x, double y, double z, double t, double a) {
return x + y;
}
def code(x, y, z, t, a): return x + y
function code(x, y, z, t, a) return Float64(x + y) end
function tmp = code(x, y, z, t, a) tmp = x + y; end
code[x_, y_, z_, t_, a_] := N[(x + y), $MachinePrecision]
x + y
Initial program 85.3%
Taylor expanded in t around inf
lower-+.f6460.6%
Applied rewrites60.6%
(FPCore (x y z t a) :precision binary64 y)
double code(double x, double y, double z, double t, double a) {
return y;
}
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 = y
end function
public static double code(double x, double y, double z, double t, double a) {
return y;
}
def code(x, y, z, t, a): return y
function code(x, y, z, t, a) return y end
function tmp = code(x, y, z, t, a) tmp = y; end
code[x_, y_, z_, t_, a_] := y
y
Initial program 85.3%
Taylor expanded in t around inf
lower-+.f6460.6%
Applied rewrites60.6%
Taylor expanded in x around 0
Applied rewrites19.2%
herbie shell --seed 2025212
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
:precision binary64
(+ x (/ (* y (- z t)) (- a t))))