
(FPCore (x y z) :precision binary64 (+ (+ (/ x 2.0) (* y x)) z))
double code(double x, double y, double z) {
return ((x / 2.0) + (y * x)) + z;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((x / 2.0d0) + (y * x)) + z
end function
public static double code(double x, double y, double z) {
return ((x / 2.0) + (y * x)) + z;
}
def code(x, y, z): return ((x / 2.0) + (y * x)) + z
function code(x, y, z) return Float64(Float64(Float64(x / 2.0) + Float64(y * x)) + z) end
function tmp = code(x, y, z) tmp = ((x / 2.0) + (y * x)) + z; end
code[x_, y_, z_] := N[(N[(N[(x / 2.0), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{x}{2} + y \cdot x\right) + z
\end{array}
Herbie found 6 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (+ (/ x 2.0) (* y x)) z))
double code(double x, double y, double z) {
return ((x / 2.0) + (y * x)) + z;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((x / 2.0d0) + (y * x)) + z
end function
public static double code(double x, double y, double z) {
return ((x / 2.0) + (y * x)) + z;
}
def code(x, y, z): return ((x / 2.0) + (y * x)) + z
function code(x, y, z) return Float64(Float64(Float64(x / 2.0) + Float64(y * x)) + z) end
function tmp = code(x, y, z) tmp = ((x / 2.0) + (y * x)) + z; end
code[x_, y_, z_] := N[(N[(N[(x / 2.0), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{x}{2} + y \cdot x\right) + z
\end{array}
(FPCore (x y z) :precision binary64 (fma (+ 0.5 y) x z))
double code(double x, double y, double z) {
return fma((0.5 + y), x, z);
}
function code(x, y, z) return fma(Float64(0.5 + y), x, z) end
code[x_, y_, z_] := N[(N[(0.5 + y), $MachinePrecision] * x + z), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(0.5 + y, x, z\right)
\end{array}
Initial program 100.0%
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
frac-2negN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (/ x 2.0) (* y x))))
(if (<= t_0 -2e+86)
(* y x)
(if (<= t_0 -1e+21)
(* 0.5 x)
(if (<= t_0 1e+41) z (if (<= t_0 5e+275) (* 0.5 x) (* y x)))))))
double code(double x, double y, double z) {
double t_0 = (x / 2.0) + (y * x);
double tmp;
if (t_0 <= -2e+86) {
tmp = y * x;
} else if (t_0 <= -1e+21) {
tmp = 0.5 * x;
} else if (t_0 <= 1e+41) {
tmp = z;
} else if (t_0 <= 5e+275) {
tmp = 0.5 * x;
} else {
tmp = y * x;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (x / 2.0d0) + (y * x)
if (t_0 <= (-2d+86)) then
tmp = y * x
else if (t_0 <= (-1d+21)) then
tmp = 0.5d0 * x
else if (t_0 <= 1d+41) then
tmp = z
else if (t_0 <= 5d+275) then
tmp = 0.5d0 * x
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x / 2.0) + (y * x);
double tmp;
if (t_0 <= -2e+86) {
tmp = y * x;
} else if (t_0 <= -1e+21) {
tmp = 0.5 * x;
} else if (t_0 <= 1e+41) {
tmp = z;
} else if (t_0 <= 5e+275) {
tmp = 0.5 * x;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y, z): t_0 = (x / 2.0) + (y * x) tmp = 0 if t_0 <= -2e+86: tmp = y * x elif t_0 <= -1e+21: tmp = 0.5 * x elif t_0 <= 1e+41: tmp = z elif t_0 <= 5e+275: tmp = 0.5 * x else: tmp = y * x return tmp
function code(x, y, z) t_0 = Float64(Float64(x / 2.0) + Float64(y * x)) tmp = 0.0 if (t_0 <= -2e+86) tmp = Float64(y * x); elseif (t_0 <= -1e+21) tmp = Float64(0.5 * x); elseif (t_0 <= 1e+41) tmp = z; elseif (t_0 <= 5e+275) tmp = Float64(0.5 * x); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x / 2.0) + (y * x); tmp = 0.0; if (t_0 <= -2e+86) tmp = y * x; elseif (t_0 <= -1e+21) tmp = 0.5 * x; elseif (t_0 <= 1e+41) tmp = z; elseif (t_0 <= 5e+275) tmp = 0.5 * x; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x / 2.0), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+86], N[(y * x), $MachinePrecision], If[LessEqual[t$95$0, -1e+21], N[(0.5 * x), $MachinePrecision], If[LessEqual[t$95$0, 1e+41], z, If[LessEqual[t$95$0, 5e+275], N[(0.5 * x), $MachinePrecision], N[(y * x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{2} + y \cdot x\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+86}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{+21}:\\
\;\;\;\;0.5 \cdot x\\
\mathbf{elif}\;t\_0 \leq 10^{+41}:\\
\;\;\;\;z\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+275}:\\
\;\;\;\;0.5 \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if (+.f64 (/.f64 x #s(literal 2 binary64)) (*.f64 y x)) < -2e86 or 5.0000000000000003e275 < (+.f64 (/.f64 x #s(literal 2 binary64)) (*.f64 y x)) Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6464.3
Applied rewrites64.3%
if -2e86 < (+.f64 (/.f64 x #s(literal 2 binary64)) (*.f64 y x)) < -1e21 or 1.00000000000000001e41 < (+.f64 (/.f64 x #s(literal 2 binary64)) (*.f64 y x)) < 5.0000000000000003e275Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-+.f6473.1
Applied rewrites73.1%
Taylor expanded in y around 0
Applied rewrites36.7%
if -1e21 < (+.f64 (/.f64 x #s(literal 2 binary64)) (*.f64 y x)) < 1.00000000000000001e41Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites70.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ (/ x 2.0) (* y x)))) (if (<= t_0 -1e+64) (* y x) (if (<= t_0 5e+105) z (* y x)))))
double code(double x, double y, double z) {
double t_0 = (x / 2.0) + (y * x);
double tmp;
if (t_0 <= -1e+64) {
tmp = y * x;
} else if (t_0 <= 5e+105) {
tmp = z;
} else {
tmp = y * x;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (x / 2.0d0) + (y * x)
if (t_0 <= (-1d+64)) then
tmp = y * x
else if (t_0 <= 5d+105) then
tmp = z
else
tmp = y * x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x / 2.0) + (y * x);
double tmp;
if (t_0 <= -1e+64) {
tmp = y * x;
} else if (t_0 <= 5e+105) {
tmp = z;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y, z): t_0 = (x / 2.0) + (y * x) tmp = 0 if t_0 <= -1e+64: tmp = y * x elif t_0 <= 5e+105: tmp = z else: tmp = y * x return tmp
function code(x, y, z) t_0 = Float64(Float64(x / 2.0) + Float64(y * x)) tmp = 0.0 if (t_0 <= -1e+64) tmp = Float64(y * x); elseif (t_0 <= 5e+105) tmp = z; else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x / 2.0) + (y * x); tmp = 0.0; if (t_0 <= -1e+64) tmp = y * x; elseif (t_0 <= 5e+105) tmp = z; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x / 2.0), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+64], N[(y * x), $MachinePrecision], If[LessEqual[t$95$0, 5e+105], z, N[(y * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{2} + y \cdot x\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+64}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+105}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if (+.f64 (/.f64 x #s(literal 2 binary64)) (*.f64 y x)) < -1.00000000000000002e64 or 5.00000000000000046e105 < (+.f64 (/.f64 x #s(literal 2 binary64)) (*.f64 y x)) Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6457.3
Applied rewrites57.3%
if -1.00000000000000002e64 < (+.f64 (/.f64 x #s(literal 2 binary64)) (*.f64 y x)) < 5.00000000000000046e105Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites65.1%
(FPCore (x y z) :precision binary64 (if (<= y -0.85) (fma y x z) (if (<= y 0.5) (fma 0.5 x z) (fma y x z))))
double code(double x, double y, double z) {
double tmp;
if (y <= -0.85) {
tmp = fma(y, x, z);
} else if (y <= 0.5) {
tmp = fma(0.5, x, z);
} else {
tmp = fma(y, x, z);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -0.85) tmp = fma(y, x, z); elseif (y <= 0.5) tmp = fma(0.5, x, z); else tmp = fma(y, x, z); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -0.85], N[(y * x + z), $MachinePrecision], If[LessEqual[y, 0.5], N[(0.5 * x + z), $MachinePrecision], N[(y * x + z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.85:\\
\;\;\;\;\mathsf{fma}\left(y, x, z\right)\\
\mathbf{elif}\;y \leq 0.5:\\
\;\;\;\;\mathsf{fma}\left(0.5, x, z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, z\right)\\
\end{array}
\end{array}
if y < -0.849999999999999978 or 0.5 < y Initial program 100.0%
lift-+.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
frac-2negN/A
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
metadata-evalN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
Applied rewrites99.1%
if -0.849999999999999978 < y < 0.5Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f6498.9
Applied rewrites98.9%
(FPCore (x y z) :precision binary64 (if (<= y -7.2e+53) (* y x) (if (<= y 2.9e+71) (fma 0.5 x z) (* y x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -7.2e+53) {
tmp = y * x;
} else if (y <= 2.9e+71) {
tmp = fma(0.5, x, z);
} else {
tmp = y * x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -7.2e+53) tmp = Float64(y * x); elseif (y <= 2.9e+71) tmp = fma(0.5, x, z); else tmp = Float64(y * x); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -7.2e+53], N[(y * x), $MachinePrecision], If[LessEqual[y, 2.9e+71], N[(0.5 * x + z), $MachinePrecision], N[(y * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{+53}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{+71}:\\
\;\;\;\;\mathsf{fma}\left(0.5, x, z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if y < -7.2e53 or 2.90000000000000007e71 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lift-*.f6474.4
Applied rewrites74.4%
if -7.2e53 < y < 2.90000000000000007e71Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f6490.2
Applied rewrites90.2%
(FPCore (x y z) :precision binary64 z)
double code(double x, double y, double z) {
return z;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = z
end function
public static double code(double x, double y, double z) {
return z;
}
def code(x, y, z): return z
function code(x, y, z) return z end
function tmp = code(x, y, z) tmp = z; end
code[x_, y_, z_] := z
\begin{array}{l}
\\
z
\end{array}
Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites40.8%
herbie shell --seed 2025107
(FPCore (x y z)
:name "Data.Histogram.Bin.BinF:$cfromIndex from histogram-fill-0.8.4.1"
:precision binary64
(+ (+ (/ x 2.0) (* y x)) z))