
(FPCore (z0 z1) :precision binary64 (log (+ z0 (* (- 1 z0) (exp (/ -2 z1))))))
double code(double z0, double z1) {
return log((z0 + ((1.0 - z0) * exp((-2.0 / z1)))));
}
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(z0, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z1
code = log((z0 + ((1.0d0 - z0) * exp(((-2.0d0) / z1)))))
end function
public static double code(double z0, double z1) {
return Math.log((z0 + ((1.0 - z0) * Math.exp((-2.0 / z1)))));
}
def code(z0, z1): return math.log((z0 + ((1.0 - z0) * math.exp((-2.0 / z1)))))
function code(z0, z1) return log(Float64(z0 + Float64(Float64(1.0 - z0) * exp(Float64(-2.0 / z1))))) end
function tmp = code(z0, z1) tmp = log((z0 + ((1.0 - z0) * exp((-2.0 / z1))))); end
code[z0_, z1_] := N[Log[N[(z0 + N[(N[(1 - z0), $MachinePrecision] * N[Exp[N[(-2 / z1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\log \left(z0 + \left(1 - z0\right) \cdot e^{\frac{-2}{z1}}\right)
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z0 z1) :precision binary64 (log (+ z0 (* (- 1 z0) (exp (/ -2 z1))))))
double code(double z0, double z1) {
return log((z0 + ((1.0 - z0) * exp((-2.0 / z1)))));
}
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(z0, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z1
code = log((z0 + ((1.0d0 - z0) * exp(((-2.0d0) / z1)))))
end function
public static double code(double z0, double z1) {
return Math.log((z0 + ((1.0 - z0) * Math.exp((-2.0 / z1)))));
}
def code(z0, z1): return math.log((z0 + ((1.0 - z0) * math.exp((-2.0 / z1)))))
function code(z0, z1) return log(Float64(z0 + Float64(Float64(1.0 - z0) * exp(Float64(-2.0 / z1))))) end
function tmp = code(z0, z1) tmp = log((z0 + ((1.0 - z0) * exp((-2.0 / z1))))); end
code[z0_, z1_] := N[Log[N[(z0 + N[(N[(1 - z0), $MachinePrecision] * N[Exp[N[(-2 / z1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\log \left(z0 + \left(1 - z0\right) \cdot e^{\frac{-2}{z1}}\right)
(FPCore (z0 z1)
:precision binary64
(let* ((t_0 (exp (/ -2 z1))) (t_1 (/ (* t_0 (- 1 z0)) z0)))
(if (<= t_0 9007199164668999/9007199254740992)
(log (* (/ (- (* 1 1) (* t_1 t_1)) (- 1 t_1)) z0))
(log
(-
(- z0 (* (- z0 1) (cosh (/ 2 z1))))
(* (- z0 1) (sinh (/ -2 z1))))))))double code(double z0, double z1) {
double t_0 = exp((-2.0 / z1));
double t_1 = (t_0 * (1.0 - z0)) / z0;
double tmp;
if (t_0 <= 0.99999999) {
tmp = log(((((1.0 * 1.0) - (t_1 * t_1)) / (1.0 - t_1)) * z0));
} else {
tmp = log(((z0 - ((z0 - 1.0) * cosh((2.0 / z1)))) - ((z0 - 1.0) * sinh((-2.0 / z1)))));
}
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(z0, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp(((-2.0d0) / z1))
t_1 = (t_0 * (1.0d0 - z0)) / z0
if (t_0 <= 0.99999999d0) then
tmp = log(((((1.0d0 * 1.0d0) - (t_1 * t_1)) / (1.0d0 - t_1)) * z0))
else
tmp = log(((z0 - ((z0 - 1.0d0) * cosh((2.0d0 / z1)))) - ((z0 - 1.0d0) * sinh(((-2.0d0) / z1)))))
end if
code = tmp
end function
public static double code(double z0, double z1) {
double t_0 = Math.exp((-2.0 / z1));
double t_1 = (t_0 * (1.0 - z0)) / z0;
double tmp;
if (t_0 <= 0.99999999) {
tmp = Math.log(((((1.0 * 1.0) - (t_1 * t_1)) / (1.0 - t_1)) * z0));
} else {
tmp = Math.log(((z0 - ((z0 - 1.0) * Math.cosh((2.0 / z1)))) - ((z0 - 1.0) * Math.sinh((-2.0 / z1)))));
}
return tmp;
}
def code(z0, z1): t_0 = math.exp((-2.0 / z1)) t_1 = (t_0 * (1.0 - z0)) / z0 tmp = 0 if t_0 <= 0.99999999: tmp = math.log(((((1.0 * 1.0) - (t_1 * t_1)) / (1.0 - t_1)) * z0)) else: tmp = math.log(((z0 - ((z0 - 1.0) * math.cosh((2.0 / z1)))) - ((z0 - 1.0) * math.sinh((-2.0 / z1))))) return tmp
function code(z0, z1) t_0 = exp(Float64(-2.0 / z1)) t_1 = Float64(Float64(t_0 * Float64(1.0 - z0)) / z0) tmp = 0.0 if (t_0 <= 0.99999999) tmp = log(Float64(Float64(Float64(Float64(1.0 * 1.0) - Float64(t_1 * t_1)) / Float64(1.0 - t_1)) * z0)); else tmp = log(Float64(Float64(z0 - Float64(Float64(z0 - 1.0) * cosh(Float64(2.0 / z1)))) - Float64(Float64(z0 - 1.0) * sinh(Float64(-2.0 / z1))))); end return tmp end
function tmp_2 = code(z0, z1) t_0 = exp((-2.0 / z1)); t_1 = (t_0 * (1.0 - z0)) / z0; tmp = 0.0; if (t_0 <= 0.99999999) tmp = log(((((1.0 * 1.0) - (t_1 * t_1)) / (1.0 - t_1)) * z0)); else tmp = log(((z0 - ((z0 - 1.0) * cosh((2.0 / z1)))) - ((z0 - 1.0) * sinh((-2.0 / z1))))); end tmp_2 = tmp; end
code[z0_, z1_] := Block[{t$95$0 = N[Exp[N[(-2 / z1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[(1 - z0), $MachinePrecision]), $MachinePrecision] / z0), $MachinePrecision]}, If[LessEqual[t$95$0, 9007199164668999/9007199254740992], N[Log[N[(N[(N[(N[(1 * 1), $MachinePrecision] - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(1 - t$95$1), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision]], $MachinePrecision], N[Log[N[(N[(z0 - N[(N[(z0 - 1), $MachinePrecision] * N[Cosh[N[(2 / z1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(z0 - 1), $MachinePrecision] * N[Sinh[N[(-2 / z1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
t_0 := e^{\frac{-2}{z1}}\\
t_1 := \frac{t\_0 \cdot \left(1 - z0\right)}{z0}\\
\mathbf{if}\;t\_0 \leq \frac{9007199164668999}{9007199254740992}:\\
\;\;\;\;\log \left(\frac{1 \cdot 1 - t\_1 \cdot t\_1}{1 - t\_1} \cdot z0\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(\left(z0 - \left(z0 - 1\right) \cdot \cosh \left(\frac{2}{z1}\right)\right) - \left(z0 - 1\right) \cdot \sinh \left(\frac{-2}{z1}\right)\right)\\
\end{array}
if (exp.f64 (/.f64 #s(literal -2 binary64) z1)) < 0.99999998999999995Initial program 27.2%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites27.1%
Applied rewrites25.4%
if 0.99999998999999995 < (exp.f64 (/.f64 #s(literal -2 binary64) z1)) Initial program 27.2%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
fp-cancel-sub-sign-invN/A
lift-exp.f64N/A
sinh-+-cosh-revN/A
distribute-rgt-inN/A
associate--r+N/A
*-commutativeN/A
lower--.f64N/A
Applied rewrites14.8%
(FPCore (z0 z1)
:precision binary64
(let* ((t_0 (exp (/ -2 z1))))
(if (<= t_0 9007199164668999/9007199254740992)
(log (* (- 1 (* (/ t_0 z0) (- z0 1))) z0))
(log
(-
(- z0 (* (- z0 1) (cosh (/ 2 z1))))
(* (- z0 1) (sinh (/ -2 z1))))))))double code(double z0, double z1) {
double t_0 = exp((-2.0 / z1));
double tmp;
if (t_0 <= 0.99999999) {
tmp = log(((1.0 - ((t_0 / z0) * (z0 - 1.0))) * z0));
} else {
tmp = log(((z0 - ((z0 - 1.0) * cosh((2.0 / z1)))) - ((z0 - 1.0) * sinh((-2.0 / z1)))));
}
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(z0, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z1
real(8) :: t_0
real(8) :: tmp
t_0 = exp(((-2.0d0) / z1))
if (t_0 <= 0.99999999d0) then
tmp = log(((1.0d0 - ((t_0 / z0) * (z0 - 1.0d0))) * z0))
else
tmp = log(((z0 - ((z0 - 1.0d0) * cosh((2.0d0 / z1)))) - ((z0 - 1.0d0) * sinh(((-2.0d0) / z1)))))
end if
code = tmp
end function
public static double code(double z0, double z1) {
double t_0 = Math.exp((-2.0 / z1));
double tmp;
if (t_0 <= 0.99999999) {
tmp = Math.log(((1.0 - ((t_0 / z0) * (z0 - 1.0))) * z0));
} else {
tmp = Math.log(((z0 - ((z0 - 1.0) * Math.cosh((2.0 / z1)))) - ((z0 - 1.0) * Math.sinh((-2.0 / z1)))));
}
return tmp;
}
def code(z0, z1): t_0 = math.exp((-2.0 / z1)) tmp = 0 if t_0 <= 0.99999999: tmp = math.log(((1.0 - ((t_0 / z0) * (z0 - 1.0))) * z0)) else: tmp = math.log(((z0 - ((z0 - 1.0) * math.cosh((2.0 / z1)))) - ((z0 - 1.0) * math.sinh((-2.0 / z1))))) return tmp
function code(z0, z1) t_0 = exp(Float64(-2.0 / z1)) tmp = 0.0 if (t_0 <= 0.99999999) tmp = log(Float64(Float64(1.0 - Float64(Float64(t_0 / z0) * Float64(z0 - 1.0))) * z0)); else tmp = log(Float64(Float64(z0 - Float64(Float64(z0 - 1.0) * cosh(Float64(2.0 / z1)))) - Float64(Float64(z0 - 1.0) * sinh(Float64(-2.0 / z1))))); end return tmp end
function tmp_2 = code(z0, z1) t_0 = exp((-2.0 / z1)); tmp = 0.0; if (t_0 <= 0.99999999) tmp = log(((1.0 - ((t_0 / z0) * (z0 - 1.0))) * z0)); else tmp = log(((z0 - ((z0 - 1.0) * cosh((2.0 / z1)))) - ((z0 - 1.0) * sinh((-2.0 / z1))))); end tmp_2 = tmp; end
code[z0_, z1_] := Block[{t$95$0 = N[Exp[N[(-2 / z1), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 9007199164668999/9007199254740992], N[Log[N[(N[(1 - N[(N[(t$95$0 / z0), $MachinePrecision] * N[(z0 - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision]], $MachinePrecision], N[Log[N[(N[(z0 - N[(N[(z0 - 1), $MachinePrecision] * N[Cosh[N[(2 / z1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(z0 - 1), $MachinePrecision] * N[Sinh[N[(-2 / z1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
t_0 := e^{\frac{-2}{z1}}\\
\mathbf{if}\;t\_0 \leq \frac{9007199164668999}{9007199254740992}:\\
\;\;\;\;\log \left(\left(1 - \frac{t\_0}{z0} \cdot \left(z0 - 1\right)\right) \cdot z0\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(\left(z0 - \left(z0 - 1\right) \cdot \cosh \left(\frac{2}{z1}\right)\right) - \left(z0 - 1\right) \cdot \sinh \left(\frac{-2}{z1}\right)\right)\\
\end{array}
if (exp.f64 (/.f64 #s(literal -2 binary64) z1)) < 0.99999998999999995Initial program 27.2%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites27.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6427.2%
Applied rewrites27.2%
if 0.99999998999999995 < (exp.f64 (/.f64 #s(literal -2 binary64) z1)) Initial program 27.2%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
fp-cancel-sub-sign-invN/A
lift-exp.f64N/A
sinh-+-cosh-revN/A
distribute-rgt-inN/A
associate--r+N/A
*-commutativeN/A
lower--.f64N/A
Applied rewrites14.8%
(FPCore (z0 z1) :precision binary64 (let* ((t_0 (exp (/ -2 z1)))) (log (+ (- z0 (* t_0 z0)) t_0))))
double code(double z0, double z1) {
double t_0 = exp((-2.0 / z1));
return log(((z0 - (t_0 * z0)) + t_0));
}
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(z0, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z1
real(8) :: t_0
t_0 = exp(((-2.0d0) / z1))
code = log(((z0 - (t_0 * z0)) + t_0))
end function
public static double code(double z0, double z1) {
double t_0 = Math.exp((-2.0 / z1));
return Math.log(((z0 - (t_0 * z0)) + t_0));
}
def code(z0, z1): t_0 = math.exp((-2.0 / z1)) return math.log(((z0 - (t_0 * z0)) + t_0))
function code(z0, z1) t_0 = exp(Float64(-2.0 / z1)) return log(Float64(Float64(z0 - Float64(t_0 * z0)) + t_0)) end
function tmp = code(z0, z1) t_0 = exp((-2.0 / z1)); tmp = log(((z0 - (t_0 * z0)) + t_0)); end
code[z0_, z1_] := Block[{t$95$0 = N[Exp[N[(-2 / z1), $MachinePrecision]], $MachinePrecision]}, N[Log[N[(N[(z0 - N[(t$95$0 * z0), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
t_0 := e^{\frac{-2}{z1}}\\
\log \left(\left(z0 - t\_0 \cdot z0\right) + t\_0\right)
\end{array}
Initial program 27.2%
lift-+.f64N/A
lift-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
fp-cancel-sub-sign-invN/A
lift-exp.f64N/A
sinh-+-cosh-revN/A
distribute-rgt-inN/A
associate--r+N/A
*-commutativeN/A
lower--.f64N/A
Applied rewrites14.8%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-+l+N/A
lift--.f64N/A
sub-negate-revN/A
lift--.f64N/A
lift-cosh.f64N/A
lift-/.f64N/A
metadata-evalN/A
distribute-neg-fracN/A
lift-/.f64N/A
cosh-neg-revN/A
Applied rewrites28.0%
(FPCore (z0 z1) :precision binary64 (log (+ z0 (* (* (* (- 1 z0) (/ -1 z0)) (- z0)) (exp (/ -2 z1))))))
double code(double z0, double z1) {
return log((z0 + ((((1.0 - z0) * (-1.0 / z0)) * -z0) * exp((-2.0 / z1)))));
}
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(z0, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z1
code = log((z0 + ((((1.0d0 - z0) * ((-1.0d0) / z0)) * -z0) * exp(((-2.0d0) / z1)))))
end function
public static double code(double z0, double z1) {
return Math.log((z0 + ((((1.0 - z0) * (-1.0 / z0)) * -z0) * Math.exp((-2.0 / z1)))));
}
def code(z0, z1): return math.log((z0 + ((((1.0 - z0) * (-1.0 / z0)) * -z0) * math.exp((-2.0 / z1)))))
function code(z0, z1) return log(Float64(z0 + Float64(Float64(Float64(Float64(1.0 - z0) * Float64(-1.0 / z0)) * Float64(-z0)) * exp(Float64(-2.0 / z1))))) end
function tmp = code(z0, z1) tmp = log((z0 + ((((1.0 - z0) * (-1.0 / z0)) * -z0) * exp((-2.0 / z1))))); end
code[z0_, z1_] := N[Log[N[(z0 + N[(N[(N[(N[(1 - z0), $MachinePrecision] * N[(-1 / z0), $MachinePrecision]), $MachinePrecision] * (-z0)), $MachinePrecision] * N[Exp[N[(-2 / z1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\log \left(z0 + \left(\left(\left(1 - z0\right) \cdot \frac{-1}{z0}\right) \cdot \left(-z0\right)\right) \cdot e^{\frac{-2}{z1}}\right)
Initial program 27.2%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
sum-to-multN/A
lower-unsound-*.f64N/A
lower-unsound-+.f64N/A
lower-unsound-/.f64N/A
lower-neg.f64N/A
lower-neg.f6427.1%
Applied rewrites27.1%
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
mult-flipN/A
*-lft-identityN/A
+-commutativeN/A
lift-neg.f64N/A
sub-flipN/A
lift--.f64N/A
lift-/.f64N/A
lower-*.f6427.2%
lift-/.f64N/A
metadata-evalN/A
lift-neg.f64N/A
frac-2neg-revN/A
lower-/.f6427.2%
Applied rewrites27.2%
(FPCore (z0 z1) :precision binary64 (log (* (- 1 (* (/ (exp (/ -2 z1)) z0) (- z0 1))) z0)))
double code(double z0, double z1) {
return log(((1.0 - ((exp((-2.0 / z1)) / z0) * (z0 - 1.0))) * z0));
}
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(z0, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z1
code = log(((1.0d0 - ((exp(((-2.0d0) / z1)) / z0) * (z0 - 1.0d0))) * z0))
end function
public static double code(double z0, double z1) {
return Math.log(((1.0 - ((Math.exp((-2.0 / z1)) / z0) * (z0 - 1.0))) * z0));
}
def code(z0, z1): return math.log(((1.0 - ((math.exp((-2.0 / z1)) / z0) * (z0 - 1.0))) * z0))
function code(z0, z1) return log(Float64(Float64(1.0 - Float64(Float64(exp(Float64(-2.0 / z1)) / z0) * Float64(z0 - 1.0))) * z0)) end
function tmp = code(z0, z1) tmp = log(((1.0 - ((exp((-2.0 / z1)) / z0) * (z0 - 1.0))) * z0)); end
code[z0_, z1_] := N[Log[N[(N[(1 - N[(N[(N[Exp[N[(-2 / z1), $MachinePrecision]], $MachinePrecision] / z0), $MachinePrecision] * N[(z0 - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision]], $MachinePrecision]
\log \left(\left(1 - \frac{e^{\frac{-2}{z1}}}{z0} \cdot \left(z0 - 1\right)\right) \cdot z0\right)
Initial program 27.2%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
sub-to-multN/A
lower-unsound-*.f64N/A
Applied rewrites27.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6427.2%
Applied rewrites27.2%
(FPCore (z0 z1) :precision binary64 (log (+ z0 (* (- 1 z0) (sqrt (exp (/ -4 z1)))))))
double code(double z0, double z1) {
return log((z0 + ((1.0 - z0) * sqrt(exp((-4.0 / z1))))));
}
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(z0, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z1
code = log((z0 + ((1.0d0 - z0) * sqrt(exp(((-4.0d0) / z1))))))
end function
public static double code(double z0, double z1) {
return Math.log((z0 + ((1.0 - z0) * Math.sqrt(Math.exp((-4.0 / z1))))));
}
def code(z0, z1): return math.log((z0 + ((1.0 - z0) * math.sqrt(math.exp((-4.0 / z1))))))
function code(z0, z1) return log(Float64(z0 + Float64(Float64(1.0 - z0) * sqrt(exp(Float64(-4.0 / z1)))))) end
function tmp = code(z0, z1) tmp = log((z0 + ((1.0 - z0) * sqrt(exp((-4.0 / z1)))))); end
code[z0_, z1_] := N[Log[N[(z0 + N[(N[(1 - z0), $MachinePrecision] * N[Sqrt[N[Exp[N[(-4 / z1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\log \left(z0 + \left(1 - z0\right) \cdot \sqrt{e^{\frac{-4}{z1}}}\right)
Initial program 27.2%
lift-exp.f64N/A
exp-fabsN/A
lift-exp.f64N/A
rem-sqrt-square-revN/A
lower-sqrt.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
prod-expN/A
lower-exp.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-add-revN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
metadata-eval27.2%
Applied rewrites27.2%
herbie shell --seed 2025277 -o generate:taylor -o generate:evaluate
(FPCore (z0 z1)
:name "(log (+ z0 (* (- 1 z0) (exp (/ -2 z1)))))"
:precision binary64
(log (+ z0 (* (- 1 z0) (exp (/ -2 z1))))))