
(FPCore (z0 z1) :precision binary64 (log (- (exp (/ (- z0) z1)) -1.0)))
double code(double z0, double z1) {
return log((exp((-z0 / z1)) - -1.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
code = log((exp((-z0 / z1)) - (-1.0d0)))
end function
public static double code(double z0, double z1) {
return Math.log((Math.exp((-z0 / z1)) - -1.0));
}
def code(z0, z1): return math.log((math.exp((-z0 / z1)) - -1.0))
function code(z0, z1) return log(Float64(exp(Float64(Float64(-z0) / z1)) - -1.0)) end
function tmp = code(z0, z1) tmp = log((exp((-z0 / z1)) - -1.0)); end
code[z0_, z1_] := N[Log[N[(N[Exp[N[((-z0) / z1), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]], $MachinePrecision]
\log \left(e^{\frac{-z0}{z1}} - -1\right)
Herbie found 5 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z0 z1) :precision binary64 (log (- (exp (/ (- z0) z1)) -1.0)))
double code(double z0, double z1) {
return log((exp((-z0 / z1)) - -1.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
code = log((exp((-z0 / z1)) - (-1.0d0)))
end function
public static double code(double z0, double z1) {
return Math.log((Math.exp((-z0 / z1)) - -1.0));
}
def code(z0, z1): return math.log((math.exp((-z0 / z1)) - -1.0))
function code(z0, z1) return log(Float64(exp(Float64(Float64(-z0) / z1)) - -1.0)) end
function tmp = code(z0, z1) tmp = log((exp((-z0 / z1)) - -1.0)); end
code[z0_, z1_] := N[Log[N[(N[Exp[N[((-z0) / z1), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]], $MachinePrecision]
\log \left(e^{\frac{-z0}{z1}} - -1\right)
(FPCore (z0 z1)
:precision binary64
(let* ((t_0 (/ (- z0) z1)))
(if (<= t_0 -1e+57)
(* z0 (/ (- (* 0.6931471805599453 z1) (* 0.5 z0)) (* z0 z1)))
(if (<= t_0 -1000000000000.0)
(/ (/ (- (* (* (log 2.0) z1) z1) (* (* 0.5 z0) z1)) z1) z1)
(+ 0.6931471805599453 (* -0.5 (/ z0 z1)))))))double code(double z0, double z1) {
double t_0 = -z0 / z1;
double tmp;
if (t_0 <= -1e+57) {
tmp = z0 * (((0.6931471805599453 * z1) - (0.5 * z0)) / (z0 * z1));
} else if (t_0 <= -1000000000000.0) {
tmp = ((((log(2.0) * z1) * z1) - ((0.5 * z0) * z1)) / z1) / z1;
} else {
tmp = 0.6931471805599453 + (-0.5 * (z0 / 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 = -z0 / z1
if (t_0 <= (-1d+57)) then
tmp = z0 * (((0.6931471805599453d0 * z1) - (0.5d0 * z0)) / (z0 * z1))
else if (t_0 <= (-1000000000000.0d0)) then
tmp = ((((log(2.0d0) * z1) * z1) - ((0.5d0 * z0) * z1)) / z1) / z1
else
tmp = 0.6931471805599453d0 + ((-0.5d0) * (z0 / z1))
end if
code = tmp
end function
public static double code(double z0, double z1) {
double t_0 = -z0 / z1;
double tmp;
if (t_0 <= -1e+57) {
tmp = z0 * (((0.6931471805599453 * z1) - (0.5 * z0)) / (z0 * z1));
} else if (t_0 <= -1000000000000.0) {
tmp = ((((Math.log(2.0) * z1) * z1) - ((0.5 * z0) * z1)) / z1) / z1;
} else {
tmp = 0.6931471805599453 + (-0.5 * (z0 / z1));
}
return tmp;
}
def code(z0, z1): t_0 = -z0 / z1 tmp = 0 if t_0 <= -1e+57: tmp = z0 * (((0.6931471805599453 * z1) - (0.5 * z0)) / (z0 * z1)) elif t_0 <= -1000000000000.0: tmp = ((((math.log(2.0) * z1) * z1) - ((0.5 * z0) * z1)) / z1) / z1 else: tmp = 0.6931471805599453 + (-0.5 * (z0 / z1)) return tmp
function code(z0, z1) t_0 = Float64(Float64(-z0) / z1) tmp = 0.0 if (t_0 <= -1e+57) tmp = Float64(z0 * Float64(Float64(Float64(0.6931471805599453 * z1) - Float64(0.5 * z0)) / Float64(z0 * z1))); elseif (t_0 <= -1000000000000.0) tmp = Float64(Float64(Float64(Float64(Float64(log(2.0) * z1) * z1) - Float64(Float64(0.5 * z0) * z1)) / z1) / z1); else tmp = Float64(0.6931471805599453 + Float64(-0.5 * Float64(z0 / z1))); end return tmp end
function tmp_2 = code(z0, z1) t_0 = -z0 / z1; tmp = 0.0; if (t_0 <= -1e+57) tmp = z0 * (((0.6931471805599453 * z1) - (0.5 * z0)) / (z0 * z1)); elseif (t_0 <= -1000000000000.0) tmp = ((((log(2.0) * z1) * z1) - ((0.5 * z0) * z1)) / z1) / z1; else tmp = 0.6931471805599453 + (-0.5 * (z0 / z1)); end tmp_2 = tmp; end
code[z0_, z1_] := Block[{t$95$0 = N[((-z0) / z1), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+57], N[(z0 * N[(N[(N[(0.6931471805599453 * z1), $MachinePrecision] - N[(0.5 * z0), $MachinePrecision]), $MachinePrecision] / N[(z0 * z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -1000000000000.0], N[(N[(N[(N[(N[(N[Log[2.0], $MachinePrecision] * z1), $MachinePrecision] * z1), $MachinePrecision] - N[(N[(0.5 * z0), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision] / z1), $MachinePrecision] / z1), $MachinePrecision], N[(0.6931471805599453 + N[(-0.5 * N[(z0 / z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{-z0}{z1}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+57}:\\
\;\;\;\;z0 \cdot \frac{0.6931471805599453 \cdot z1 - 0.5 \cdot z0}{z0 \cdot z1}\\
\mathbf{elif}\;t\_0 \leq -1000000000000:\\
\;\;\;\;\frac{\frac{\left(\log 2 \cdot z1\right) \cdot z1 - \left(0.5 \cdot z0\right) \cdot z1}{z1}}{z1}\\
\mathbf{else}:\\
\;\;\;\;0.6931471805599453 + -0.5 \cdot \frac{z0}{z1}\\
\end{array}
if (/.f64 (neg.f64 z0) z1) < -1e57Initial program 99.3%
Taylor expanded in z0 around 0
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-/.f6466.4%
Applied rewrites66.4%
Taylor expanded in z0 around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-/.f6466.3%
Applied rewrites66.3%
Evaluated real constant66.3%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
lift-/.f64N/A
metadata-evalN/A
lift-/.f64N/A
mult-flipN/A
common-denominatorN/A
lower-/.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6455.3%
Applied rewrites55.3%
if -1e57 < (/.f64 (neg.f64 z0) z1) < -1e12Initial program 99.3%
Taylor expanded in z0 around 0
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-/.f6466.4%
Applied rewrites66.4%
lift-+.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lift-/.f64N/A
associate-*r/N/A
sub-to-fractionN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval66.3%
Applied rewrites66.3%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
frac-subN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6438.1%
Applied rewrites38.1%
if -1e12 < (/.f64 (neg.f64 z0) z1) Initial program 99.3%
Taylor expanded in z0 around 0
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-/.f6466.4%
Applied rewrites66.4%
Evaluated real constant66.4%
(FPCore (z0 z1) :precision binary64 (if (<= (/ (- z0) z1) -1e+57) (* z0 (/ (- (* 0.6931471805599453 z1) (* 0.5 z0)) (* z0 z1))) (+ 0.6931471805599453 (* -0.5 (/ z0 z1)))))
double code(double z0, double z1) {
double tmp;
if ((-z0 / z1) <= -1e+57) {
tmp = z0 * (((0.6931471805599453 * z1) - (0.5 * z0)) / (z0 * z1));
} else {
tmp = 0.6931471805599453 + (-0.5 * (z0 / 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) :: tmp
if ((-z0 / z1) <= (-1d+57)) then
tmp = z0 * (((0.6931471805599453d0 * z1) - (0.5d0 * z0)) / (z0 * z1))
else
tmp = 0.6931471805599453d0 + ((-0.5d0) * (z0 / z1))
end if
code = tmp
end function
public static double code(double z0, double z1) {
double tmp;
if ((-z0 / z1) <= -1e+57) {
tmp = z0 * (((0.6931471805599453 * z1) - (0.5 * z0)) / (z0 * z1));
} else {
tmp = 0.6931471805599453 + (-0.5 * (z0 / z1));
}
return tmp;
}
def code(z0, z1): tmp = 0 if (-z0 / z1) <= -1e+57: tmp = z0 * (((0.6931471805599453 * z1) - (0.5 * z0)) / (z0 * z1)) else: tmp = 0.6931471805599453 + (-0.5 * (z0 / z1)) return tmp
function code(z0, z1) tmp = 0.0 if (Float64(Float64(-z0) / z1) <= -1e+57) tmp = Float64(z0 * Float64(Float64(Float64(0.6931471805599453 * z1) - Float64(0.5 * z0)) / Float64(z0 * z1))); else tmp = Float64(0.6931471805599453 + Float64(-0.5 * Float64(z0 / z1))); end return tmp end
function tmp_2 = code(z0, z1) tmp = 0.0; if ((-z0 / z1) <= -1e+57) tmp = z0 * (((0.6931471805599453 * z1) - (0.5 * z0)) / (z0 * z1)); else tmp = 0.6931471805599453 + (-0.5 * (z0 / z1)); end tmp_2 = tmp; end
code[z0_, z1_] := If[LessEqual[N[((-z0) / z1), $MachinePrecision], -1e+57], N[(z0 * N[(N[(N[(0.6931471805599453 * z1), $MachinePrecision] - N[(0.5 * z0), $MachinePrecision]), $MachinePrecision] / N[(z0 * z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.6931471805599453 + N[(-0.5 * N[(z0 / z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\frac{-z0}{z1} \leq -1 \cdot 10^{+57}:\\
\;\;\;\;z0 \cdot \frac{0.6931471805599453 \cdot z1 - 0.5 \cdot z0}{z0 \cdot z1}\\
\mathbf{else}:\\
\;\;\;\;0.6931471805599453 + -0.5 \cdot \frac{z0}{z1}\\
\end{array}
if (/.f64 (neg.f64 z0) z1) < -1e57Initial program 99.3%
Taylor expanded in z0 around 0
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-/.f6466.4%
Applied rewrites66.4%
Taylor expanded in z0 around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-/.f6466.3%
Applied rewrites66.3%
Evaluated real constant66.3%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
lift-/.f64N/A
metadata-evalN/A
lift-/.f64N/A
mult-flipN/A
common-denominatorN/A
lower-/.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6455.3%
Applied rewrites55.3%
if -1e57 < (/.f64 (neg.f64 z0) z1) Initial program 99.3%
Taylor expanded in z0 around 0
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-/.f6466.4%
Applied rewrites66.4%
Evaluated real constant66.4%
(FPCore (z0 z1) :precision binary64 (+ 0.6931471805599453 (* -0.5 (/ z0 z1))))
double code(double z0, double z1) {
return 0.6931471805599453 + (-0.5 * (z0 / 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 = 0.6931471805599453d0 + ((-0.5d0) * (z0 / z1))
end function
public static double code(double z0, double z1) {
return 0.6931471805599453 + (-0.5 * (z0 / z1));
}
def code(z0, z1): return 0.6931471805599453 + (-0.5 * (z0 / z1))
function code(z0, z1) return Float64(0.6931471805599453 + Float64(-0.5 * Float64(z0 / z1))) end
function tmp = code(z0, z1) tmp = 0.6931471805599453 + (-0.5 * (z0 / z1)); end
code[z0_, z1_] := N[(0.6931471805599453 + N[(-0.5 * N[(z0 / z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
0.6931471805599453 + -0.5 \cdot \frac{z0}{z1}
Initial program 99.3%
Taylor expanded in z0 around 0
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-/.f6466.4%
Applied rewrites66.4%
Evaluated real constant66.4%
(FPCore (z0 z1) :precision binary64 0.6931471805599453)
double code(double z0, double z1) {
return 0.6931471805599453;
}
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 = 0.6931471805599453d0
end function
public static double code(double z0, double z1) {
return 0.6931471805599453;
}
def code(z0, z1): return 0.6931471805599453
function code(z0, z1) return 0.6931471805599453 end
function tmp = code(z0, z1) tmp = 0.6931471805599453; end
code[z0_, z1_] := 0.6931471805599453
0.6931471805599453
Initial program 99.3%
Taylor expanded in z0 around 0
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-/.f6466.4%
Applied rewrites66.4%
Evaluated real constant66.4%
Taylor expanded in z0 around 0
Applied rewrites65.9%
herbie shell --seed 2025250
(FPCore (z0 z1)
:name "(log (- (exp (/ (- z0) z1)) -1))"
:precision binary64
(log (- (exp (/ (- z0) z1)) -1.0)))