
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (fma (- y z) (- t x) x))
double code(double x, double y, double z, double t) {
return fma((y - z), (t - x), x);
}
function code(x, y, z, t) return fma(Float64(y - z), Float64(t - x), x) end
code[x_, y_, z_, t_] := N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - z, t - x, x\right)
\end{array}
Initial program 100.0%
Applied rewrites100.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (* z (- t x))))) (if (<= z -1.85e+59) t_1 (if (<= z 0.086) (fma (- t x) y x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = -(z * (t - x));
double tmp;
if (z <= -1.85e+59) {
tmp = t_1;
} else if (z <= 0.086) {
tmp = fma((t - x), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(-Float64(z * Float64(t - x))) tmp = 0.0 if (z <= -1.85e+59) tmp = t_1; elseif (z <= 0.086) tmp = fma(Float64(t - x), y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = (-N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[z, -1.85e+59], t$95$1, If[LessEqual[z, 0.086], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -z \cdot \left(t - x\right)\\
\mathbf{if}\;z \leq -1.85 \cdot 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.086:\\
\;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.84999999999999999e59 or 0.085999999999999993 < z Initial program 100.0%
Taylor expanded in z around 0
Applied rewrites59.8%
Applied rewrites59.8%
Taylor expanded in z around inf
Applied rewrites45.5%
Applied rewrites45.5%
if -1.84999999999999999e59 < z < 0.085999999999999993Initial program 100.0%
Taylor expanded in z around 0
Applied rewrites59.8%
Applied rewrites59.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))) (t_2 (- (* z (- t x)))))
(if (<= z -1.85e+59)
t_2
(if (<= z -2.1e-100)
t_1
(if (<= z 1.7e-232) (fma t y x) (if (<= z 0.086) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double t_2 = -(z * (t - x));
double tmp;
if (z <= -1.85e+59) {
tmp = t_2;
} else if (z <= -2.1e-100) {
tmp = t_1;
} else if (z <= 1.7e-232) {
tmp = fma(t, y, x);
} else if (z <= 0.086) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) t_2 = Float64(-Float64(z * Float64(t - x))) tmp = 0.0 if (z <= -1.85e+59) tmp = t_2; elseif (z <= -2.1e-100) tmp = t_1; elseif (z <= 1.7e-232) tmp = fma(t, y, x); elseif (z <= 0.086) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = (-N[(z * N[(t - x), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[z, -1.85e+59], t$95$2, If[LessEqual[z, -2.1e-100], t$95$1, If[LessEqual[z, 1.7e-232], N[(t * y + x), $MachinePrecision], If[LessEqual[z, 0.086], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
t_2 := -z \cdot \left(t - x\right)\\
\mathbf{if}\;z \leq -1.85 \cdot 10^{+59}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -2.1 \cdot 10^{-100}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-232}:\\
\;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
\mathbf{elif}\;z \leq 0.086:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -1.84999999999999999e59 or 0.085999999999999993 < z Initial program 100.0%
Taylor expanded in z around 0
Applied rewrites59.8%
Applied rewrites59.8%
Taylor expanded in z around inf
Applied rewrites45.5%
Applied rewrites45.5%
if -1.84999999999999999e59 < z < -2.10000000000000009e-100 or 1.7000000000000001e-232 < z < 0.085999999999999993Initial program 100.0%
Taylor expanded in y around inf
Applied rewrites43.9%
if -2.10000000000000009e-100 < z < 1.7000000000000001e-232Initial program 100.0%
Taylor expanded in z around 0
Applied rewrites59.8%
Applied rewrites59.8%
Taylor expanded in x around 0
Applied rewrites41.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -1.0)
t_1
(if (<= y -3.2e-166)
(fma t y x)
(if (<= y -1.95e-284) (* t (- y z)) (if (<= y 1.0) (fma t y x) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -1.0) {
tmp = t_1;
} else if (y <= -3.2e-166) {
tmp = fma(t, y, x);
} else if (y <= -1.95e-284) {
tmp = t * (y - z);
} else if (y <= 1.0) {
tmp = fma(t, y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -1.0) tmp = t_1; elseif (y <= -3.2e-166) tmp = fma(t, y, x); elseif (y <= -1.95e-284) tmp = Float64(t * Float64(y - z)); elseif (y <= 1.0) tmp = fma(t, y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.0], t$95$1, If[LessEqual[y, -3.2e-166], N[(t * y + x), $MachinePrecision], If[LessEqual[y, -1.95e-284], N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.0], N[(t * y + x), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -3.2 \cdot 10^{-166}:\\
\;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
\mathbf{elif}\;y \leq -1.95 \cdot 10^{-284}:\\
\;\;\;\;t \cdot \left(y - z\right)\\
\mathbf{elif}\;y \leq 1:\\
\;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 100.0%
Taylor expanded in y around inf
Applied rewrites43.9%
if -1 < y < -3.20000000000000001e-166 or -1.9499999999999999e-284 < y < 1Initial program 100.0%
Taylor expanded in z around 0
Applied rewrites59.8%
Applied rewrites59.8%
Taylor expanded in x around 0
Applied rewrites41.8%
if -3.20000000000000001e-166 < y < -1.9499999999999999e-284Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites49.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- y z))))
(if (<= z -4.5e+237)
t_1
(if (<= z -2.15e+69) (* x z) (if (<= z 2.8e-24) (fma t y x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = t * (y - z);
double tmp;
if (z <= -4.5e+237) {
tmp = t_1;
} else if (z <= -2.15e+69) {
tmp = x * z;
} else if (z <= 2.8e-24) {
tmp = fma(t, y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(t * Float64(y - z)) tmp = 0.0 if (z <= -4.5e+237) tmp = t_1; elseif (z <= -2.15e+69) tmp = Float64(x * z); elseif (z <= 2.8e-24) tmp = fma(t, y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.5e+237], t$95$1, If[LessEqual[z, -2.15e+69], N[(x * z), $MachinePrecision], If[LessEqual[z, 2.8e-24], N[(t * y + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(y - z\right)\\
\mathbf{if}\;z \leq -4.5 \cdot 10^{+237}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.15 \cdot 10^{+69}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{-24}:\\
\;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.49999999999999964e237 or 2.8000000000000002e-24 < z Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites49.1%
if -4.49999999999999964e237 < z < -2.14999999999999996e69Initial program 100.0%
Taylor expanded in z around 0
Applied rewrites59.8%
Applied rewrites59.8%
Taylor expanded in z around inf
Applied rewrites45.5%
Taylor expanded in x around inf
Applied rewrites22.3%
if -2.14999999999999996e69 < z < 2.8000000000000002e-24Initial program 100.0%
Taylor expanded in z around 0
Applied rewrites59.8%
Applied rewrites59.8%
Taylor expanded in x around 0
Applied rewrites41.8%
(FPCore (x y z t) :precision binary64 (if (<= z -2.15e+69) (* x z) (if (<= z 2e+61) (fma t y x) (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.15e+69) {
tmp = x * z;
} else if (z <= 2e+61) {
tmp = fma(t, y, x);
} else {
tmp = x * z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -2.15e+69) tmp = Float64(x * z); elseif (z <= 2e+61) tmp = fma(t, y, x); else tmp = Float64(x * z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.15e+69], N[(x * z), $MachinePrecision], If[LessEqual[z, 2e+61], N[(t * y + x), $MachinePrecision], N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.15 \cdot 10^{+69}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+61}:\\
\;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -2.14999999999999996e69 or 1.9999999999999999e61 < z Initial program 100.0%
Taylor expanded in z around 0
Applied rewrites59.8%
Applied rewrites59.8%
Taylor expanded in z around inf
Applied rewrites45.5%
Taylor expanded in x around inf
Applied rewrites22.3%
if -2.14999999999999996e69 < z < 1.9999999999999999e61Initial program 100.0%
Taylor expanded in z around 0
Applied rewrites59.8%
Applied rewrites59.8%
Taylor expanded in x around 0
Applied rewrites41.8%
(FPCore (x y z t) :precision binary64 (if (<= y -7.2e-20) (* t y) (if (<= y 2.15e+26) (* x z) (* t y))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.2e-20) {
tmp = t * y;
} else if (y <= 2.15e+26) {
tmp = x * z;
} else {
tmp = t * 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)
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) :: tmp
if (y <= (-7.2d-20)) then
tmp = t * y
else if (y <= 2.15d+26) then
tmp = x * z
else
tmp = t * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.2e-20) {
tmp = t * y;
} else if (y <= 2.15e+26) {
tmp = x * z;
} else {
tmp = t * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -7.2e-20: tmp = t * y elif y <= 2.15e+26: tmp = x * z else: tmp = t * y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -7.2e-20) tmp = Float64(t * y); elseif (y <= 2.15e+26) tmp = Float64(x * z); else tmp = Float64(t * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -7.2e-20) tmp = t * y; elseif (y <= 2.15e+26) tmp = x * z; else tmp = t * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -7.2e-20], N[(t * y), $MachinePrecision], If[LessEqual[y, 2.15e+26], N[(x * z), $MachinePrecision], N[(t * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{-20}:\\
\;\;\;\;t \cdot y\\
\mathbf{elif}\;y \leq 2.15 \cdot 10^{+26}:\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;t \cdot y\\
\end{array}
\end{array}
if y < -7.19999999999999948e-20 or 2.1499999999999999e26 < y Initial program 100.0%
Taylor expanded in y around inf
Applied rewrites43.9%
Taylor expanded in x around 0
Applied rewrites25.9%
if -7.19999999999999948e-20 < y < 2.1499999999999999e26Initial program 100.0%
Taylor expanded in z around 0
Applied rewrites59.8%
Applied rewrites59.8%
Taylor expanded in z around inf
Applied rewrites45.5%
Taylor expanded in x around inf
Applied rewrites22.3%
(FPCore (x y z t) :precision binary64 (* t y))
double code(double x, double y, double z, double t) {
return t * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t * y
end function
public static double code(double x, double y, double z, double t) {
return t * y;
}
def code(x, y, z, t): return t * y
function code(x, y, z, t) return Float64(t * y) end
function tmp = code(x, y, z, t) tmp = t * y; end
code[x_, y_, z_, t_] := N[(t * y), $MachinePrecision]
\begin{array}{l}
\\
t \cdot y
\end{array}
Initial program 100.0%
Taylor expanded in y around inf
Applied rewrites43.9%
Taylor expanded in x around 0
Applied rewrites25.9%
herbie shell --seed 2025160
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
(+ x (* (- y z) (- t x))))