
(FPCore (x y z t) :precision binary64 (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)))
double code(double x, double y, double z, double t) {
return x - (log(((1.0 - y) + (y * exp(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 - (log(((1.0d0 - y) + (y * exp(z)))) / t)
end function
public static double code(double x, double y, double z, double t) {
return x - (Math.log(((1.0 - y) + (y * Math.exp(z)))) / t);
}
def code(x, y, z, t): return x - (math.log(((1.0 - y) + (y * math.exp(z)))) / t)
function code(x, y, z, t) return Float64(x - Float64(log(Float64(Float64(1.0 - y) + Float64(y * exp(z)))) / t)) end
function tmp = code(x, y, z, t) tmp = x - (log(((1.0 - y) + (y * exp(z)))) / t); end
code[x_, y_, z_, t_] := N[(x - N[(N[Log[N[(N[(1.0 - y), $MachinePrecision] + N[(y * N[Exp[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)))
double code(double x, double y, double z, double t) {
return x - (log(((1.0 - y) + (y * exp(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 - (log(((1.0d0 - y) + (y * exp(z)))) / t)
end function
public static double code(double x, double y, double z, double t) {
return x - (Math.log(((1.0 - y) + (y * Math.exp(z)))) / t);
}
def code(x, y, z, t): return x - (math.log(((1.0 - y) + (y * math.exp(z)))) / t)
function code(x, y, z, t) return Float64(x - Float64(log(Float64(Float64(1.0 - y) + Float64(y * exp(z)))) / t)) end
function tmp = code(x, y, z, t) tmp = x - (log(((1.0 - y) + (y * exp(z)))) / t); end
code[x_, y_, z_, t_] := N[(x - N[(N[Log[N[(N[(1.0 - y), $MachinePrecision] + N[(y * N[Exp[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
x - \frac{\log \left(\left(1 - y\right) + y \cdot e^{z}\right)}{t}
(FPCore (x y z t) :precision binary64 (if (<= z -9000000.0) (- x (/ 1.0 (+ (* 0.5 t) (/ t (* (- (exp z) 1.0) y))))) (- x (/ 1.0 (/ (+ (* 0.5 (* t y)) (/ (+ t (* -0.5 (* t z))) z)) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9000000.0) {
tmp = x - (1.0 / ((0.5 * t) + (t / ((exp(z) - 1.0) * y))));
} else {
tmp = x - (1.0 / (((0.5 * (t * y)) + ((t + (-0.5 * (t * z))) / z)) / 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 (z <= (-9000000.0d0)) then
tmp = x - (1.0d0 / ((0.5d0 * t) + (t / ((exp(z) - 1.0d0) * y))))
else
tmp = x - (1.0d0 / (((0.5d0 * (t * y)) + ((t + ((-0.5d0) * (t * z))) / z)) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9000000.0) {
tmp = x - (1.0 / ((0.5 * t) + (t / ((Math.exp(z) - 1.0) * y))));
} else {
tmp = x - (1.0 / (((0.5 * (t * y)) + ((t + (-0.5 * (t * z))) / z)) / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -9000000.0: tmp = x - (1.0 / ((0.5 * t) + (t / ((math.exp(z) - 1.0) * y)))) else: tmp = x - (1.0 / (((0.5 * (t * y)) + ((t + (-0.5 * (t * z))) / z)) / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -9000000.0) tmp = Float64(x - Float64(1.0 / Float64(Float64(0.5 * t) + Float64(t / Float64(Float64(exp(z) - 1.0) * y))))); else tmp = Float64(x - Float64(1.0 / Float64(Float64(Float64(0.5 * Float64(t * y)) + Float64(Float64(t + Float64(-0.5 * Float64(t * z))) / z)) / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -9000000.0) tmp = x - (1.0 / ((0.5 * t) + (t / ((exp(z) - 1.0) * y)))); else tmp = x - (1.0 / (((0.5 * (t * y)) + ((t + (-0.5 * (t * z))) / z)) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -9000000.0], N[(x - N[(1.0 / N[(N[(0.5 * t), $MachinePrecision] + N[(t / N[(N[(N[Exp[z], $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(1.0 / N[(N[(N[(0.5 * N[(t * y), $MachinePrecision]), $MachinePrecision] + N[(N[(t + N[(-0.5 * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z \leq -9000000:\\
\;\;\;\;x - \frac{1}{0.5 \cdot t + \frac{t}{\left(e^{z} - 1\right) \cdot y}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{1}{\frac{0.5 \cdot \left(t \cdot y\right) + \frac{t + -0.5 \cdot \left(t \cdot z\right)}{z}}{y}}\\
\end{array}
if z < -9e6Initial program 61.1%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6464.3%
Applied rewrites64.3%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6464.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6464.3%
Applied rewrites64.3%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-exp.f6475.2%
Applied rewrites75.2%
lift-/.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
add-to-fraction-revN/A
lower-+.f64N/A
lower-*.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f6478.3%
Applied rewrites78.3%
if -9e6 < z Initial program 61.1%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6464.3%
Applied rewrites64.3%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6464.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6464.3%
Applied rewrites64.3%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-exp.f6475.2%
Applied rewrites75.2%
Taylor expanded in z around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6483.3%
Applied rewrites83.3%
(FPCore (x y z t) :precision binary64 (if (<= z -9.2e+54) (- x (/ (* y (- (exp z) 1.0)) t)) (- x (/ 1.0 (/ (+ (* 0.5 (* t y)) (/ (+ t (* -0.5 (* t z))) z)) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9.2e+54) {
tmp = x - ((y * (exp(z) - 1.0)) / t);
} else {
tmp = x - (1.0 / (((0.5 * (t * y)) + ((t + (-0.5 * (t * z))) / z)) / 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 (z <= (-9.2d+54)) then
tmp = x - ((y * (exp(z) - 1.0d0)) / t)
else
tmp = x - (1.0d0 / (((0.5d0 * (t * y)) + ((t + ((-0.5d0) * (t * z))) / z)) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9.2e+54) {
tmp = x - ((y * (Math.exp(z) - 1.0)) / t);
} else {
tmp = x - (1.0 / (((0.5 * (t * y)) + ((t + (-0.5 * (t * z))) / z)) / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -9.2e+54: tmp = x - ((y * (math.exp(z) - 1.0)) / t) else: tmp = x - (1.0 / (((0.5 * (t * y)) + ((t + (-0.5 * (t * z))) / z)) / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -9.2e+54) tmp = Float64(x - Float64(Float64(y * Float64(exp(z) - 1.0)) / t)); else tmp = Float64(x - Float64(1.0 / Float64(Float64(Float64(0.5 * Float64(t * y)) + Float64(Float64(t + Float64(-0.5 * Float64(t * z))) / z)) / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -9.2e+54) tmp = x - ((y * (exp(z) - 1.0)) / t); else tmp = x - (1.0 / (((0.5 * (t * y)) + ((t + (-0.5 * (t * z))) / z)) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -9.2e+54], N[(x - N[(N[(y * N[(N[Exp[z], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x - N[(1.0 / N[(N[(N[(0.5 * N[(t * y), $MachinePrecision]), $MachinePrecision] + N[(N[(t + N[(-0.5 * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{+54}:\\
\;\;\;\;x - \frac{y \cdot \left(e^{z} - 1\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{1}{\frac{0.5 \cdot \left(t \cdot y\right) + \frac{t + -0.5 \cdot \left(t \cdot z\right)}{z}}{y}}\\
\end{array}
if z < -9.1999999999999998e54Initial program 61.1%
Taylor expanded in y around 0
lower-*.f64N/A
lower--.f64N/A
lower-exp.f6475.6%
Applied rewrites75.6%
if -9.1999999999999998e54 < z Initial program 61.1%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6464.3%
Applied rewrites64.3%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6464.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6464.3%
Applied rewrites64.3%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-exp.f6475.2%
Applied rewrites75.2%
Taylor expanded in z around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6483.3%
Applied rewrites83.3%
(FPCore (x y z t) :precision binary64 (- x (/ 1.0 (/ (+ (* 0.5 (* t y)) (/ (+ t (* -0.5 (* t z))) z)) y))))
double code(double x, double y, double z, double t) {
return x - (1.0 / (((0.5 * (t * y)) + ((t + (-0.5 * (t * z))) / z)) / 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 = x - (1.0d0 / (((0.5d0 * (t * y)) + ((t + ((-0.5d0) * (t * z))) / z)) / y))
end function
public static double code(double x, double y, double z, double t) {
return x - (1.0 / (((0.5 * (t * y)) + ((t + (-0.5 * (t * z))) / z)) / y));
}
def code(x, y, z, t): return x - (1.0 / (((0.5 * (t * y)) + ((t + (-0.5 * (t * z))) / z)) / y))
function code(x, y, z, t) return Float64(x - Float64(1.0 / Float64(Float64(Float64(0.5 * Float64(t * y)) + Float64(Float64(t + Float64(-0.5 * Float64(t * z))) / z)) / y))) end
function tmp = code(x, y, z, t) tmp = x - (1.0 / (((0.5 * (t * y)) + ((t + (-0.5 * (t * z))) / z)) / y)); end
code[x_, y_, z_, t_] := N[(x - N[(1.0 / N[(N[(N[(0.5 * N[(t * y), $MachinePrecision]), $MachinePrecision] + N[(N[(t + N[(-0.5 * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x - \frac{1}{\frac{0.5 \cdot \left(t \cdot y\right) + \frac{t + -0.5 \cdot \left(t \cdot z\right)}{z}}{y}}
Initial program 61.1%
Taylor expanded in z around 0
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6464.3%
Applied rewrites64.3%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6464.3%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6464.3%
Applied rewrites64.3%
Taylor expanded in y around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-exp.f6475.2%
Applied rewrites75.2%
Taylor expanded in z around 0
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6483.3%
Applied rewrites83.3%
(FPCore (x y z t) :precision binary64 (if (<= (exp z) 0.0) (* 1.0 x) (- x (* y (/ (* z (+ 1.0 (* 0.5 z))) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (exp(z) <= 0.0) {
tmp = 1.0 * x;
} else {
tmp = x - (y * ((z * (1.0 + (0.5 * z))) / t));
}
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 (exp(z) <= 0.0d0) then
tmp = 1.0d0 * x
else
tmp = x - (y * ((z * (1.0d0 + (0.5d0 * z))) / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (Math.exp(z) <= 0.0) {
tmp = 1.0 * x;
} else {
tmp = x - (y * ((z * (1.0 + (0.5 * z))) / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if math.exp(z) <= 0.0: tmp = 1.0 * x else: tmp = x - (y * ((z * (1.0 + (0.5 * z))) / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (exp(z) <= 0.0) tmp = Float64(1.0 * x); else tmp = Float64(x - Float64(y * Float64(Float64(z * Float64(1.0 + Float64(0.5 * z))) / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (exp(z) <= 0.0) tmp = 1.0 * x; else tmp = x - (y * ((z * (1.0 + (0.5 * z))) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[Exp[z], $MachinePrecision], 0.0], N[(1.0 * x), $MachinePrecision], N[(x - N[(y * N[(N[(z * N[(1.0 + N[(0.5 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;e^{z} \leq 0:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z \cdot \left(1 + 0.5 \cdot z\right)}{t}\\
\end{array}
if (exp.f64 z) < 0.0Initial program 61.1%
Taylor expanded in z around 0
lower-*.f6474.5%
Applied rewrites74.5%
lift--.f64N/A
sub-to-multN/A
lower-unsound-*.f64N/A
lower-unsound--.f64N/A
lower-unsound-/.f6473.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6473.1%
Applied rewrites73.1%
Taylor expanded in x around inf
Applied rewrites71.4%
if 0.0 < (exp.f64 z) Initial program 61.1%
Taylor expanded in z around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-/.f6462.0%
Applied rewrites62.0%
Taylor expanded in y around 0
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6470.5%
Applied rewrites70.5%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6469.5%
Applied rewrites69.5%
(FPCore (x y z t) :precision binary64 (if (<= z -5.8e+36) (* 1.0 x) (- x (* y (* z (/ 1.0 t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.8e+36) {
tmp = 1.0 * x;
} else {
tmp = x - (y * (z * (1.0 / t)));
}
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 (z <= (-5.8d+36)) then
tmp = 1.0d0 * x
else
tmp = x - (y * (z * (1.0d0 / t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.8e+36) {
tmp = 1.0 * x;
} else {
tmp = x - (y * (z * (1.0 / t)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.8e+36: tmp = 1.0 * x else: tmp = x - (y * (z * (1.0 / t))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.8e+36) tmp = Float64(1.0 * x); else tmp = Float64(x - Float64(y * Float64(z * Float64(1.0 / t)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.8e+36) tmp = 1.0 * x; else tmp = x - (y * (z * (1.0 / t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.8e+36], N[(1.0 * x), $MachinePrecision], N[(x - N[(y * N[(z * N[(1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+36}:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \left(z \cdot \frac{1}{t}\right)\\
\end{array}
if z < -5.8e36Initial program 61.1%
Taylor expanded in z around 0
lower-*.f6474.5%
Applied rewrites74.5%
lift--.f64N/A
sub-to-multN/A
lower-unsound-*.f64N/A
lower-unsound--.f64N/A
lower-unsound-/.f6473.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6473.1%
Applied rewrites73.1%
Taylor expanded in x around inf
Applied rewrites71.4%
if -5.8e36 < z Initial program 61.1%
Taylor expanded in z around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-/.f6462.0%
Applied rewrites62.0%
Taylor expanded in y around 0
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6470.5%
Applied rewrites70.5%
Taylor expanded in z around 0
lower-/.f6475.0%
Applied rewrites75.0%
(FPCore (x y z t) :precision binary64 (if (<= z -5.8e+36) (* 1.0 x) (- x (/ (* y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.8e+36) {
tmp = 1.0 * x;
} else {
tmp = x - ((y * z) / t);
}
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 (z <= (-5.8d+36)) then
tmp = 1.0d0 * x
else
tmp = x - ((y * z) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.8e+36) {
tmp = 1.0 * x;
} else {
tmp = x - ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.8e+36: tmp = 1.0 * x else: tmp = x - ((y * z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.8e+36) tmp = Float64(1.0 * x); else tmp = Float64(x - Float64(Float64(y * z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.8e+36) tmp = 1.0 * x; else tmp = x - ((y * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.8e+36], N[(1.0 * x), $MachinePrecision], N[(x - N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+36}:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot z}{t}\\
\end{array}
if z < -5.8e36Initial program 61.1%
Taylor expanded in z around 0
lower-*.f6474.5%
Applied rewrites74.5%
lift--.f64N/A
sub-to-multN/A
lower-unsound-*.f64N/A
lower-unsound--.f64N/A
lower-unsound-/.f6473.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6473.1%
Applied rewrites73.1%
Taylor expanded in x around inf
Applied rewrites71.4%
if -5.8e36 < z Initial program 61.1%
Taylor expanded in z around 0
lower-*.f6474.5%
Applied rewrites74.5%
(FPCore (x y z t) :precision binary64 (* 1.0 x))
double code(double x, double y, double z, double t) {
return 1.0 * 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 = 1.0d0 * x
end function
public static double code(double x, double y, double z, double t) {
return 1.0 * x;
}
def code(x, y, z, t): return 1.0 * x
function code(x, y, z, t) return Float64(1.0 * x) end
function tmp = code(x, y, z, t) tmp = 1.0 * x; end
code[x_, y_, z_, t_] := N[(1.0 * x), $MachinePrecision]
1 \cdot x
Initial program 61.1%
Taylor expanded in z around 0
lower-*.f6474.5%
Applied rewrites74.5%
lift--.f64N/A
sub-to-multN/A
lower-unsound-*.f64N/A
lower-unsound--.f64N/A
lower-unsound-/.f6473.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6473.1%
Applied rewrites73.1%
Taylor expanded in x around inf
Applied rewrites71.4%
herbie shell --seed 2025258
(FPCore (x y z t)
:name "System.Random.MWC.Distributions:truncatedExp from mwc-random-0.13.3.2"
:precision binary64
(- x (/ (log (+ (- 1.0 y) (* y (exp z)))) t)))