
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / 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)
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 - x) * z) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
def code(x, y, z, t): return x + (((y - x) * z) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(y - x) * z) / t)) end
function tmp = code(x, y, z, t) tmp = x + (((y - x) * z) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
x + \frac{\left(y - x\right) \cdot z}{t}
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / 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)
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 - x) * z) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
def code(x, y, z, t): return x + (((y - x) * z) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(y - x) * z) / t)) end
function tmp = code(x, y, z, t) tmp = x + (((y - x) * z) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
x + \frac{\left(y - x\right) \cdot z}{t}
(FPCore (x y z t) :precision binary64 (if (<= z 1.15e-204) (fma (/ z t) (- y x) x) (fma (/ (- y x) t) z x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.15e-204) {
tmp = fma((z / t), (y - x), x);
} else {
tmp = fma(((y - x) / t), z, x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= 1.15e-204) tmp = fma(Float64(z / t), Float64(y - x), x); else tmp = fma(Float64(Float64(y - x) / t), z, x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.15e-204], N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z \leq 1.15 \cdot 10^{-204}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - x}{t}, z, x\right)\\
\end{array}
if z < 1.15e-204Initial program 92.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6497.7%
Applied rewrites97.7%
if 1.15e-204 < z Initial program 92.3%
lift-+.f64N/A
+-commutativeN/A
remove-double-negN/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
remove-double-negN/A
lower-fma.f64N/A
mult-flip-revN/A
lower-/.f6492.7%
Applied rewrites92.7%
(FPCore (x y z t) :precision binary64 (fma (/ z t) (- y x) x))
double code(double x, double y, double z, double t) {
return fma((z / t), (y - x), x);
}
function code(x, y, z, t) return fma(Float64(z / t), Float64(y - x), x) end
code[x_, y_, z_, t_] := N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]
\mathsf{fma}\left(\frac{z}{t}, y - x, x\right)
Initial program 92.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6497.7%
Applied rewrites97.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (/ y t) z x)))
(if (<= y -5800000000000.0)
t_1
(if (<= y 1.5e-106) (- x (* (/ z t) x)) t_1))))double code(double x, double y, double z, double t) {
double t_1 = fma((y / t), z, x);
double tmp;
if (y <= -5800000000000.0) {
tmp = t_1;
} else if (y <= 1.5e-106) {
tmp = x - ((z / t) * x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(y / t), z, x) tmp = 0.0 if (y <= -5800000000000.0) tmp = t_1; elseif (y <= 1.5e-106) tmp = Float64(x - Float64(Float64(z / t) * x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[y, -5800000000000.0], t$95$1, If[LessEqual[y, 1.5e-106], N[(x - N[(N[(z / t), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{t}, z, x\right)\\
\mathbf{if}\;y \leq -5800000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{-106}:\\
\;\;\;\;x - \frac{z}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if y < -5.8e12 or 1.50000000000000009e-106 < y Initial program 92.3%
Taylor expanded in x around 0
Applied rewrites73.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
mult-flipN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mult-flip-revN/A
lower-/.f6473.2%
Applied rewrites73.2%
if -5.8e12 < y < 1.50000000000000009e-106Initial program 92.3%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f6492.7%
Applied rewrites92.7%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f6460.3%
Applied rewrites60.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6464.9%
Applied rewrites64.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (/ y t) z x)))
(if (<= y -5800000000000.0)
t_1
(if (<= y 1.5e-106) (* x (- 1.0 (/ z t))) t_1))))double code(double x, double y, double z, double t) {
double t_1 = fma((y / t), z, x);
double tmp;
if (y <= -5800000000000.0) {
tmp = t_1;
} else if (y <= 1.5e-106) {
tmp = x * (1.0 - (z / t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(y / t), z, x) tmp = 0.0 if (y <= -5800000000000.0) tmp = t_1; elseif (y <= 1.5e-106) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[y, -5800000000000.0], t$95$1, If[LessEqual[y, 1.5e-106], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{t}, z, x\right)\\
\mathbf{if}\;y \leq -5800000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.5 \cdot 10^{-106}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if y < -5.8e12 or 1.50000000000000009e-106 < y Initial program 92.3%
Taylor expanded in x around 0
Applied rewrites73.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
mult-flipN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mult-flip-revN/A
lower-/.f6473.2%
Applied rewrites73.2%
if -5.8e12 < y < 1.50000000000000009e-106Initial program 92.3%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f6492.7%
Applied rewrites92.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f6464.9%
Applied rewrites64.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma (/ y t) z x))) (if (<= t -0.00085) t_1 (if (<= t 3.25e-108) (/ (* z (- y x)) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((y / t), z, x);
double tmp;
if (t <= -0.00085) {
tmp = t_1;
} else if (t <= 3.25e-108) {
tmp = (z * (y - x)) / t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(y / t), z, x) tmp = 0.0 if (t <= -0.00085) tmp = t_1; elseif (t <= 3.25e-108) tmp = Float64(Float64(z * Float64(y - x)) / t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[t, -0.00085], t$95$1, If[LessEqual[t, 3.25e-108], N[(N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{t}, z, x\right)\\
\mathbf{if}\;t \leq -0.00085:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.25 \cdot 10^{-108}:\\
\;\;\;\;\frac{z \cdot \left(y - x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if t < -8.49999999999999953e-4 or 3.2500000000000001e-108 < t Initial program 92.3%
Taylor expanded in x around 0
Applied rewrites73.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
mult-flipN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mult-flip-revN/A
lower-/.f6473.2%
Applied rewrites73.2%
if -8.49999999999999953e-4 < t < 3.2500000000000001e-108Initial program 92.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6438.2%
Applied rewrites38.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6438.0%
Applied rewrites38.0%
Taylor expanded in z around -inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6458.4%
Applied rewrites58.4%
(FPCore (x y z t) :precision binary64 (fma (/ y t) z x))
double code(double x, double y, double z, double t) {
return fma((y / t), z, x);
}
function code(x, y, z, t) return fma(Float64(y / t), z, x) end
code[x_, y_, z_, t_] := N[(N[(y / t), $MachinePrecision] * z + x), $MachinePrecision]
\mathsf{fma}\left(\frac{y}{t}, z, x\right)
Initial program 92.3%
Taylor expanded in x around 0
Applied rewrites73.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
mult-flipN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mult-flip-revN/A
lower-/.f6473.2%
Applied rewrites73.2%
(FPCore (x y z t) :precision binary64 (/ z (/ t y)))
double code(double x, double y, double z, double t) {
return z / (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 = z / (t / y)
end function
public static double code(double x, double y, double z, double t) {
return z / (t / y);
}
def code(x, y, z, t): return z / (t / y)
function code(x, y, z, t) return Float64(z / Float64(t / y)) end
function tmp = code(x, y, z, t) tmp = z / (t / y); end
code[x_, y_, z_, t_] := N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision]
\frac{z}{\frac{t}{y}}
Initial program 92.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6438.2%
Applied rewrites38.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6438.0%
Applied rewrites38.0%
lift-*.f64N/A
lift-/.f64N/A
div-flip-revN/A
associate-/r/N/A
div-flip-revN/A
lower-/.f64N/A
lower-/.f6438.2%
Applied rewrites38.2%
(FPCore (x y z t) :precision binary64 (* (/ z t) y))
double code(double x, double y, double z, double t) {
return (z / 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 = (z / t) * y
end function
public static double code(double x, double y, double z, double t) {
return (z / t) * y;
}
def code(x, y, z, t): return (z / t) * y
function code(x, y, z, t) return Float64(Float64(z / t) * y) end
function tmp = code(x, y, z, t) tmp = (z / t) * y; end
code[x_, y_, z_, t_] := N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]
\frac{z}{t} \cdot y
Initial program 92.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6438.2%
Applied rewrites38.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6441.4%
Applied rewrites41.4%
(FPCore (x y z t) :precision binary64 (* (/ y t) z))
double code(double x, double y, double z, double t) {
return (y / t) * 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, 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 = (y / t) * z
end function
public static double code(double x, double y, double z, double t) {
return (y / t) * z;
}
def code(x, y, z, t): return (y / t) * z
function code(x, y, z, t) return Float64(Float64(y / t) * z) end
function tmp = code(x, y, z, t) tmp = (y / t) * z; end
code[x_, y_, z_, t_] := N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]
\frac{y}{t} \cdot z
Initial program 92.3%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6438.2%
Applied rewrites38.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6438.0%
Applied rewrites38.0%
herbie shell --seed 2025183
(FPCore (x y z t)
:name "Numeric.Histogram:binBounds from Chart-1.5.3"
:precision binary64
(+ x (/ (* (- y x) z) t)))