
(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]
x + \left(y - z\right) \cdot \left(t - x\right)
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]
x + \left(y - z\right) \cdot \left(t - x\right)
(FPCore (x y z t) :precision binary64 (fma (- z y) (- x t) x))
double code(double x, double y, double z, double t) {
return fma((z - y), (x - t), x);
}
function code(x, y, z, t) return fma(Float64(z - y), Float64(x - t), x) end
code[x_, y_, z_, t_] := N[(N[(z - y), $MachinePrecision] * N[(x - t), $MachinePrecision] + x), $MachinePrecision]
\mathsf{fma}\left(z - y, x - t, x\right)
Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (- t x)))) (if (<= y -6.2e+43) t_1 (if (<= y 1.15e+57) (fma z (- x t) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -6.2e+43) {
tmp = t_1;
} else if (y <= 1.15e+57) {
tmp = fma(z, (x - t), 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 <= -6.2e+43) tmp = t_1; elseif (y <= 1.15e+57) tmp = fma(z, Float64(x - t), 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, -6.2e+43], t$95$1, If[LessEqual[y, 1.15e+57], N[(z * N[(x - t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -6.2 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{+57}:\\
\;\;\;\;\mathsf{fma}\left(z, x - t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if y < -6.2000000000000003e43 or 1.1499999999999999e57 < y Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6443.9%
Applied rewrites43.9%
if -6.2000000000000003e43 < y < 1.1499999999999999e57Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in y around 0
Applied rewrites61.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- x t)))) (if (<= z -5.4e+40) t_1 (if (<= z 2.35e+44) (fma (- t x) y x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -5.4e+40) {
tmp = t_1;
} else if (z <= 2.35e+44) {
tmp = fma((t - x), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -5.4e+40) tmp = t_1; elseif (z <= 2.35e+44) 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[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.4e+40], t$95$1, If[LessEqual[z, 2.35e+44], N[(N[(t - x), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -5.4 \cdot 10^{+40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.35 \cdot 10^{+44}:\\
\;\;\;\;\mathsf{fma}\left(t - x, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -5.4000000000000002e40 or 2.3500000000000001e44 < z Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f6445.6%
Applied rewrites45.6%
if -5.4000000000000002e40 < z < 2.3500000000000001e44Initial program 100.0%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f6459.7%
Applied rewrites59.7%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6459.7%
Applied rewrites59.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- x t)))) (if (<= z -1.3e+19) t_1 (if (<= z 3.2e+14) (fma t y x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -1.3e+19) {
tmp = t_1;
} else if (z <= 3.2e+14) {
tmp = fma(t, y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -1.3e+19) tmp = t_1; elseif (z <= 3.2e+14) tmp = fma(t, y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.3e+19], t$95$1, If[LessEqual[z, 3.2e+14], N[(t * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{+19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{+14}:\\
\;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -1.3e19 or 3.2e14 < z Initial program 100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-outN/A
lift--.f64N/A
sub-negate-revN/A
lower-fma.f64N/A
lower--.f64N/A
lower--.f64100.0%
Applied rewrites100.0%
Taylor expanded in z around inf
lower-*.f64N/A
lower--.f6445.6%
Applied rewrites45.6%
if -1.3e19 < z < 3.2e14Initial program 100.0%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f6459.7%
Applied rewrites59.7%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6459.7%
Applied rewrites59.7%
Taylor expanded in x around 0
Applied rewrites41.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* t (- y z)))) (if (<= z -2.35e-6) t_1 (if (<= z 6.8e+17) (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 <= -2.35e-6) {
tmp = t_1;
} else if (z <= 6.8e+17) {
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 <= -2.35e-6) tmp = t_1; elseif (z <= 6.8e+17) 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, -2.35e-6], t$95$1, If[LessEqual[z, 6.8e+17], N[(t * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := t \cdot \left(y - z\right)\\
\mathbf{if}\;z \leq -2.35 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{+17}:\\
\;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -2.3499999999999999e-6 or 6.8e17 < z Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6449.0%
Applied rewrites49.0%
if -2.3499999999999999e-6 < z < 6.8e17Initial program 100.0%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f6459.7%
Applied rewrites59.7%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6459.7%
Applied rewrites59.7%
Taylor expanded in x around 0
Applied rewrites41.8%
(FPCore (x y z t) :precision binary64 (if (<= y -2.05e+100) (* (- x) y) (fma t y x)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.05e+100) {
tmp = -x * y;
} else {
tmp = fma(t, y, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -2.05e+100) tmp = Float64(Float64(-x) * y); else tmp = fma(t, y, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.05e+100], N[((-x) * y), $MachinePrecision], N[(t * y + x), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;y \leq -2.05 \cdot 10^{+100}:\\
\;\;\;\;\left(-x\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, y, x\right)\\
\end{array}
if y < -2.0500000000000001e100Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6443.9%
Applied rewrites43.9%
Taylor expanded in x around inf
lower-*.f6422.0%
Applied rewrites22.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6422.0%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6422.0%
Applied rewrites22.0%
if -2.0500000000000001e100 < y Initial program 100.0%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f6459.7%
Applied rewrites59.7%
lift-+.f64N/A
+-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift--.f6459.7%
Applied rewrites59.7%
Taylor expanded in x around 0
Applied rewrites41.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- x) y))) (if (<= x -4e-19) t_1 (if (<= x 2.8e-47) (* t y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = -x * y;
double tmp;
if (x <= -4e-19) {
tmp = t_1;
} else if (x <= 2.8e-47) {
tmp = t * y;
} 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)
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) :: t_1
real(8) :: tmp
t_1 = -x * y
if (x <= (-4d-19)) then
tmp = t_1
else if (x <= 2.8d-47) then
tmp = t * y
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = -x * y;
double tmp;
if (x <= -4e-19) {
tmp = t_1;
} else if (x <= 2.8e-47) {
tmp = t * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = -x * y tmp = 0 if x <= -4e-19: tmp = t_1 elif x <= 2.8e-47: tmp = t * y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-x) * y) tmp = 0.0 if (x <= -4e-19) tmp = t_1; elseif (x <= 2.8e-47) tmp = Float64(t * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -x * y; tmp = 0.0; if (x <= -4e-19) tmp = t_1; elseif (x <= 2.8e-47) tmp = t * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-x) * y), $MachinePrecision]}, If[LessEqual[x, -4e-19], t$95$1, If[LessEqual[x, 2.8e-47], N[(t * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \left(-x\right) \cdot y\\
\mathbf{if}\;x \leq -4 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-47}:\\
\;\;\;\;t \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if x < -3.9999999999999999e-19 or 2.7999999999999999e-47 < x Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6443.9%
Applied rewrites43.9%
Taylor expanded in x around inf
lower-*.f6422.0%
Applied rewrites22.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6422.0%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6422.0%
Applied rewrites22.0%
if -3.9999999999999999e-19 < x < 2.7999999999999999e-47Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6443.9%
Applied rewrites43.9%
Taylor expanded in x around 0
lower-*.f6426.3%
Applied rewrites26.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]
t \cdot y
Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6443.9%
Applied rewrites43.9%
Taylor expanded in x around 0
lower-*.f6426.3%
Applied rewrites26.3%
herbie shell --seed 2025191
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
(+ x (* (- y z) (- t x))))