
(FPCore (z0) :precision binary64 (- (log (- (* -4.0 z0) -1.0))))
double code(double z0) {
return -log(((-4.0 * z0) - -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)
use fmin_fmax_functions
real(8), intent (in) :: z0
code = -log((((-4.0d0) * z0) - (-1.0d0)))
end function
public static double code(double z0) {
return -Math.log(((-4.0 * z0) - -1.0));
}
def code(z0): return -math.log(((-4.0 * z0) - -1.0))
function code(z0) return Float64(-log(Float64(Float64(-4.0 * z0) - -1.0))) end
function tmp = code(z0) tmp = -log(((-4.0 * z0) - -1.0)); end
code[z0_] := (-N[Log[N[(N[(-4.0 * z0), $MachinePrecision] - -1.0), $MachinePrecision]], $MachinePrecision])
-\log \left(-4 \cdot z0 - -1\right)
Herbie found 5 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z0) :precision binary64 (- (log (- (* -4.0 z0) -1.0))))
double code(double z0) {
return -log(((-4.0 * z0) - -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)
use fmin_fmax_functions
real(8), intent (in) :: z0
code = -log((((-4.0d0) * z0) - (-1.0d0)))
end function
public static double code(double z0) {
return -Math.log(((-4.0 * z0) - -1.0));
}
def code(z0): return -math.log(((-4.0 * z0) - -1.0))
function code(z0) return Float64(-log(Float64(Float64(-4.0 * z0) - -1.0))) end
function tmp = code(z0) tmp = -log(((-4.0 * z0) - -1.0)); end
code[z0_] := (-N[Log[N[(N[(-4.0 * z0), $MachinePrecision] - -1.0), $MachinePrecision]], $MachinePrecision])
-\log \left(-4 \cdot z0 - -1\right)
(FPCore (z0) :precision binary64 (if (<= z0 -1.35e-9) (log (/ 1.0 (- (* z0 -4.0) -1.0))) (+ (* (- (* 8.0 z0) -4.0) z0) (* (* (* (- (* 64.0 z0) -21.333333333333332) z0) z0) z0))))
double code(double z0) {
double tmp;
if (z0 <= -1.35e-9) {
tmp = log((1.0 / ((z0 * -4.0) - -1.0)));
} else {
tmp = (((8.0 * z0) - -4.0) * z0) + (((((64.0 * z0) - -21.333333333333332) * z0) * z0) * z0);
}
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)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8) :: tmp
if (z0 <= (-1.35d-9)) then
tmp = log((1.0d0 / ((z0 * (-4.0d0)) - (-1.0d0))))
else
tmp = (((8.0d0 * z0) - (-4.0d0)) * z0) + (((((64.0d0 * z0) - (-21.333333333333332d0)) * z0) * z0) * z0)
end if
code = tmp
end function
public static double code(double z0) {
double tmp;
if (z0 <= -1.35e-9) {
tmp = Math.log((1.0 / ((z0 * -4.0) - -1.0)));
} else {
tmp = (((8.0 * z0) - -4.0) * z0) + (((((64.0 * z0) - -21.333333333333332) * z0) * z0) * z0);
}
return tmp;
}
def code(z0): tmp = 0 if z0 <= -1.35e-9: tmp = math.log((1.0 / ((z0 * -4.0) - -1.0))) else: tmp = (((8.0 * z0) - -4.0) * z0) + (((((64.0 * z0) - -21.333333333333332) * z0) * z0) * z0) return tmp
function code(z0) tmp = 0.0 if (z0 <= -1.35e-9) tmp = log(Float64(1.0 / Float64(Float64(z0 * -4.0) - -1.0))); else tmp = Float64(Float64(Float64(Float64(8.0 * z0) - -4.0) * z0) + Float64(Float64(Float64(Float64(Float64(64.0 * z0) - -21.333333333333332) * z0) * z0) * z0)); end return tmp end
function tmp_2 = code(z0) tmp = 0.0; if (z0 <= -1.35e-9) tmp = log((1.0 / ((z0 * -4.0) - -1.0))); else tmp = (((8.0 * z0) - -4.0) * z0) + (((((64.0 * z0) - -21.333333333333332) * z0) * z0) * z0); end tmp_2 = tmp; end
code[z0_] := If[LessEqual[z0, -1.35e-9], N[Log[N[(1.0 / N[(N[(z0 * -4.0), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(N[(N[(8.0 * z0), $MachinePrecision] - -4.0), $MachinePrecision] * z0), $MachinePrecision] + N[(N[(N[(N[(N[(64.0 * z0), $MachinePrecision] - -21.333333333333332), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z0 \leq -1.35 \cdot 10^{-9}:\\
\;\;\;\;\log \left(\frac{1}{z0 \cdot -4 - -1}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(8 \cdot z0 - -4\right) \cdot z0 + \left(\left(\left(64 \cdot z0 - -21.333333333333332\right) \cdot z0\right) \cdot z0\right) \cdot z0\\
\end{array}
if z0 < -1.3500000000000001e-9Initial program 38.2%
lift-neg.f64N/A
lift-log.f64N/A
neg-logN/A
lower-log.f64N/A
lower-/.f6438.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6438.2%
Applied rewrites38.2%
if -1.3500000000000001e-9 < z0 Initial program 38.2%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6467.3%
Applied rewrites67.3%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
distribute-rgt-inN/A
lift-*.f64N/A
associate-+r+N/A
lift-+.f64N/A
distribute-rgt-inN/A
*-commutativeN/A
lift-*.f64N/A
lower-+.f64N/A
Applied rewrites67.3%
(FPCore (z0) :precision binary64 (if (<= z0 -6.5e-9) (- (log (- (* -4.0 z0) -1.0))) (+ (* (- (* 8.0 z0) -4.0) z0) (* (* (* (- (* 64.0 z0) -21.333333333333332) z0) z0) z0))))
double code(double z0) {
double tmp;
if (z0 <= -6.5e-9) {
tmp = -log(((-4.0 * z0) - -1.0));
} else {
tmp = (((8.0 * z0) - -4.0) * z0) + (((((64.0 * z0) - -21.333333333333332) * z0) * z0) * z0);
}
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)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8) :: tmp
if (z0 <= (-6.5d-9)) then
tmp = -log((((-4.0d0) * z0) - (-1.0d0)))
else
tmp = (((8.0d0 * z0) - (-4.0d0)) * z0) + (((((64.0d0 * z0) - (-21.333333333333332d0)) * z0) * z0) * z0)
end if
code = tmp
end function
public static double code(double z0) {
double tmp;
if (z0 <= -6.5e-9) {
tmp = -Math.log(((-4.0 * z0) - -1.0));
} else {
tmp = (((8.0 * z0) - -4.0) * z0) + (((((64.0 * z0) - -21.333333333333332) * z0) * z0) * z0);
}
return tmp;
}
def code(z0): tmp = 0 if z0 <= -6.5e-9: tmp = -math.log(((-4.0 * z0) - -1.0)) else: tmp = (((8.0 * z0) - -4.0) * z0) + (((((64.0 * z0) - -21.333333333333332) * z0) * z0) * z0) return tmp
function code(z0) tmp = 0.0 if (z0 <= -6.5e-9) tmp = Float64(-log(Float64(Float64(-4.0 * z0) - -1.0))); else tmp = Float64(Float64(Float64(Float64(8.0 * z0) - -4.0) * z0) + Float64(Float64(Float64(Float64(Float64(64.0 * z0) - -21.333333333333332) * z0) * z0) * z0)); end return tmp end
function tmp_2 = code(z0) tmp = 0.0; if (z0 <= -6.5e-9) tmp = -log(((-4.0 * z0) - -1.0)); else tmp = (((8.0 * z0) - -4.0) * z0) + (((((64.0 * z0) - -21.333333333333332) * z0) * z0) * z0); end tmp_2 = tmp; end
code[z0_] := If[LessEqual[z0, -6.5e-9], (-N[Log[N[(N[(-4.0 * z0), $MachinePrecision] - -1.0), $MachinePrecision]], $MachinePrecision]), N[(N[(N[(N[(8.0 * z0), $MachinePrecision] - -4.0), $MachinePrecision] * z0), $MachinePrecision] + N[(N[(N[(N[(N[(64.0 * z0), $MachinePrecision] - -21.333333333333332), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z0 \leq -6.5 \cdot 10^{-9}:\\
\;\;\;\;-\log \left(-4 \cdot z0 - -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(8 \cdot z0 - -4\right) \cdot z0 + \left(\left(\left(64 \cdot z0 - -21.333333333333332\right) \cdot z0\right) \cdot z0\right) \cdot z0\\
\end{array}
if z0 < -6.5000000000000003e-9Initial program 38.2%
if -6.5000000000000003e-9 < z0 Initial program 38.2%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6467.3%
Applied rewrites67.3%
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
distribute-rgt-inN/A
lift-*.f64N/A
associate-+r+N/A
lift-+.f64N/A
distribute-rgt-inN/A
*-commutativeN/A
lift-*.f64N/A
lower-+.f64N/A
Applied rewrites67.3%
(FPCore (z0) :precision binary64 (- (* (* (- (* 21.333333333333332 z0) -8.0) z0) z0) (* z0 -4.0)))
double code(double z0) {
return ((((21.333333333333332 * z0) - -8.0) * z0) * z0) - (z0 * -4.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)
use fmin_fmax_functions
real(8), intent (in) :: z0
code = ((((21.333333333333332d0 * z0) - (-8.0d0)) * z0) * z0) - (z0 * (-4.0d0))
end function
public static double code(double z0) {
return ((((21.333333333333332 * z0) - -8.0) * z0) * z0) - (z0 * -4.0);
}
def code(z0): return ((((21.333333333333332 * z0) - -8.0) * z0) * z0) - (z0 * -4.0)
function code(z0) return Float64(Float64(Float64(Float64(Float64(21.333333333333332 * z0) - -8.0) * z0) * z0) - Float64(z0 * -4.0)) end
function tmp = code(z0) tmp = ((((21.333333333333332 * z0) - -8.0) * z0) * z0) - (z0 * -4.0); end
code[z0_] := N[(N[(N[(N[(N[(21.333333333333332 * z0), $MachinePrecision] - -8.0), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision] - N[(z0 * -4.0), $MachinePrecision]), $MachinePrecision]
\left(\left(21.333333333333332 \cdot z0 - -8\right) \cdot z0\right) \cdot z0 - z0 \cdot -4
Initial program 38.2%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6468.2%
Applied rewrites68.2%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-commutativeN/A
lift-*.f64N/A
lower--.f64N/A
lower-*.f6468.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.2%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
metadata-eval68.2%
Applied rewrites68.2%
(FPCore (z0) :precision binary64 (* z0 (+ 4.0 (* z0 (+ 8.0 (* 21.333333333333332 z0))))))
double code(double z0) {
return z0 * (4.0 + (z0 * (8.0 + (21.333333333333332 * 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)
use fmin_fmax_functions
real(8), intent (in) :: z0
code = z0 * (4.0d0 + (z0 * (8.0d0 + (21.333333333333332d0 * z0))))
end function
public static double code(double z0) {
return z0 * (4.0 + (z0 * (8.0 + (21.333333333333332 * z0))));
}
def code(z0): return z0 * (4.0 + (z0 * (8.0 + (21.333333333333332 * z0))))
function code(z0) return Float64(z0 * Float64(4.0 + Float64(z0 * Float64(8.0 + Float64(21.333333333333332 * z0))))) end
function tmp = code(z0) tmp = z0 * (4.0 + (z0 * (8.0 + (21.333333333333332 * z0)))); end
code[z0_] := N[(z0 * N[(4.0 + N[(z0 * N[(8.0 + N[(21.333333333333332 * z0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
z0 \cdot \left(4 + z0 \cdot \left(8 + 21.333333333333332 \cdot z0\right)\right)
Initial program 38.2%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6468.2%
Applied rewrites68.2%
(FPCore (z0) :precision binary64 (* 4.0 z0))
double code(double z0) {
return 4.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)
use fmin_fmax_functions
real(8), intent (in) :: z0
code = 4.0d0 * z0
end function
public static double code(double z0) {
return 4.0 * z0;
}
def code(z0): return 4.0 * z0
function code(z0) return Float64(4.0 * z0) end
function tmp = code(z0) tmp = 4.0 * z0; end
code[z0_] := N[(4.0 * z0), $MachinePrecision]
4 \cdot z0
Initial program 38.2%
Taylor expanded in z0 around 0
lower-*.f6467.8%
Applied rewrites67.8%
herbie shell --seed 2025250
(FPCore (z0)
:name "(- (log (- (* -4 z0) -1)))"
:precision binary64
(- (log (- (* -4.0 z0) -1.0))))