
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - 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, a)
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), intent (in) :: a
code = x + (((y - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y x) (- z t)) (- a t))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - 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, a)
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), intent (in) :: a
code = x + (((y - x) * (z - t)) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - x) * (z - t)) / (a - t));
}
def code(x, y, z, t, a): return x + (((y - x) * (z - t)) / (a - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - x) * (z - t)) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (<= t_1 -1e-277)
(fma (/ (- z t) (- a t)) (- y x) x)
(if (<= t_1 0.0)
(fma (- (- y x)) (/ (- z a) t) y)
(fma (- (/ z (- a t)) (/ t (- a t))) (- y x) x)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if (t_1 <= -1e-277) {
tmp = fma(((z - t) / (a - t)), (y - x), x);
} else if (t_1 <= 0.0) {
tmp = fma(-(y - x), ((z - a) / t), y);
} else {
tmp = fma(((z / (a - t)) - (t / (a - t))), (y - x), x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if (t_1 <= -1e-277) tmp = fma(Float64(Float64(z - t) / Float64(a - t)), Float64(y - x), x); elseif (t_1 <= 0.0) tmp = fma(Float64(-Float64(y - x)), Float64(Float64(z - a) / t), y); else tmp = fma(Float64(Float64(z / Float64(a - t)) - Float64(t / Float64(a - t))), Float64(y - x), x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-277], N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[((-N[(y - x), $MachinePrecision]) * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], N[(N[(N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] - N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-277}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a - t}, y - x, x\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(-\left(y - x\right), \frac{z - a}{t}, y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a - t} - \frac{t}{a - t}, y - x, x\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -9.99999999999999969e-278Initial program 77.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6490.7
Applied rewrites90.7%
if -9.99999999999999969e-278 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 5.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f645.3
Applied rewrites5.3%
Taylor expanded in t around inf
Applied rewrites23.7%
Taylor expanded in t around inf
Applied rewrites99.6%
if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 74.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6492.5
Applied rewrites92.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6492.5
Applied rewrites92.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y x) (- z t)) (- a t)))))
(if (or (<= t_1 -1e-277) (not (<= t_1 0.0)))
(fma (/ (- z t) (- a t)) (- y x) x)
(fma (- (- y x)) (/ (- z a) t) y))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) * (z - t)) / (a - t));
double tmp;
if ((t_1 <= -1e-277) || !(t_1 <= 0.0)) {
tmp = fma(((z - t) / (a - t)), (y - x), x);
} else {
tmp = fma(-(y - x), ((z - a) / t), y);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - x) * Float64(z - t)) / Float64(a - t))) tmp = 0.0 if ((t_1 <= -1e-277) || !(t_1 <= 0.0)) tmp = fma(Float64(Float64(z - t) / Float64(a - t)), Float64(y - x), x); else tmp = fma(Float64(-Float64(y - x)), Float64(Float64(z - a) / t), y); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e-277], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[((-N[(y - x), $MachinePrecision]) * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-277} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a - t}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\left(y - x\right), \frac{z - a}{t}, y\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < -9.99999999999999969e-278 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) Initial program 75.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.7
Applied rewrites91.7%
if -9.99999999999999969e-278 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) (-.f64 z t)) (-.f64 a t))) < 0.0Initial program 5.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f645.3
Applied rewrites5.3%
Taylor expanded in t around inf
Applied rewrites23.7%
Taylor expanded in t around inf
Applied rewrites99.6%
Final simplification92.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.8e-25) (not (<= a 5.2e-12))) (fma (/ (- z t) (- a t)) y x) (fma (- (- y x)) (/ (- z a) t) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.8e-25) || !(a <= 5.2e-12)) {
tmp = fma(((z - t) / (a - t)), y, x);
} else {
tmp = fma(-(y - x), ((z - a) / t), y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.8e-25) || !(a <= 5.2e-12)) tmp = fma(Float64(Float64(z - t) / Float64(a - t)), y, x); else tmp = fma(Float64(-Float64(y - x)), Float64(Float64(z - a) / t), y); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.8e-25], N[Not[LessEqual[a, 5.2e-12]], $MachinePrecision]], N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[((-N[(y - x), $MachinePrecision]) * N[(N[(z - a), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.8 \cdot 10^{-25} \lor \neg \left(a \leq 5.2 \cdot 10^{-12}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a - t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\left(y - x\right), \frac{z - a}{t}, y\right)\\
\end{array}
\end{array}
if a < -1.8e-25 or 5.19999999999999965e-12 < a Initial program 71.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.6
Applied rewrites91.6%
Taylor expanded in x around 0
Applied rewrites78.7%
if -1.8e-25 < a < 5.19999999999999965e-12Initial program 69.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6477.9
Applied rewrites77.9%
Taylor expanded in t around inf
Applied rewrites30.4%
Taylor expanded in t around inf
Applied rewrites83.4%
Final simplification80.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -9e-26) (not (<= a 4.8e-12))) (fma (/ (- z t) (- a t)) y x) (fma (- z) (/ (- y x) t) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -9e-26) || !(a <= 4.8e-12)) {
tmp = fma(((z - t) / (a - t)), y, x);
} else {
tmp = fma(-z, ((y - x) / t), y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -9e-26) || !(a <= 4.8e-12)) tmp = fma(Float64(Float64(z - t) / Float64(a - t)), y, x); else tmp = fma(Float64(-z), Float64(Float64(y - x) / t), y); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -9e-26], N[Not[LessEqual[a, 4.8e-12]], $MachinePrecision]], N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision], N[((-z) * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9 \cdot 10^{-26} \lor \neg \left(a \leq 4.8 \cdot 10^{-12}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a - t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, \frac{y - x}{t}, y\right)\\
\end{array}
\end{array}
if a < -8.9999999999999998e-26 or 4.79999999999999974e-12 < a Initial program 71.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.6
Applied rewrites91.6%
Taylor expanded in x around 0
Applied rewrites78.7%
if -8.9999999999999998e-26 < a < 4.79999999999999974e-12Initial program 69.7%
Taylor expanded in t around inf
Applied rewrites60.2%
Taylor expanded in a around 0
Applied rewrites79.1%
Final simplification78.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -3.3e-24) (not (<= a 2.6e+53))) (fma (- z t) (/ (- y x) a) x) (fma (- z) (/ (- y x) t) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3.3e-24) || !(a <= 2.6e+53)) {
tmp = fma((z - t), ((y - x) / a), x);
} else {
tmp = fma(-z, ((y - x) / t), y);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -3.3e-24) || !(a <= 2.6e+53)) tmp = fma(Float64(z - t), Float64(Float64(y - x) / a), x); else tmp = fma(Float64(-z), Float64(Float64(y - x) / t), y); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -3.3e-24], N[Not[LessEqual[a, 2.6e+53]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[((-z) * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.3 \cdot 10^{-24} \lor \neg \left(a \leq 2.6 \cdot 10^{+53}\right):\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-z, \frac{y - x}{t}, y\right)\\
\end{array}
\end{array}
if a < -3.29999999999999984e-24 or 2.59999999999999998e53 < a Initial program 70.2%
Taylor expanded in a around inf
Applied rewrites75.6%
if -3.29999999999999984e-24 < a < 2.59999999999999998e53Initial program 70.9%
Taylor expanded in t around inf
Applied rewrites60.6%
Taylor expanded in a around 0
Applied rewrites77.6%
Final simplification76.6%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.8e-52)
y
(if (<= t -3.05e-214)
x
(if (<= t 1.85e-44) (* y (/ z a)) (if (<= t 1.3e+168) x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.8e-52) {
tmp = y;
} else if (t <= -3.05e-214) {
tmp = x;
} else if (t <= 1.85e-44) {
tmp = y * (z / a);
} else if (t <= 1.3e+168) {
tmp = x;
} else {
tmp = 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, a)
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), intent (in) :: a
real(8) :: tmp
if (t <= (-1.8d-52)) then
tmp = y
else if (t <= (-3.05d-214)) then
tmp = x
else if (t <= 1.85d-44) then
tmp = y * (z / a)
else if (t <= 1.3d+168) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.8e-52) {
tmp = y;
} else if (t <= -3.05e-214) {
tmp = x;
} else if (t <= 1.85e-44) {
tmp = y * (z / a);
} else if (t <= 1.3e+168) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.8e-52: tmp = y elif t <= -3.05e-214: tmp = x elif t <= 1.85e-44: tmp = y * (z / a) elif t <= 1.3e+168: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.8e-52) tmp = y; elseif (t <= -3.05e-214) tmp = x; elseif (t <= 1.85e-44) tmp = Float64(y * Float64(z / a)); elseif (t <= 1.3e+168) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.8e-52) tmp = y; elseif (t <= -3.05e-214) tmp = x; elseif (t <= 1.85e-44) tmp = y * (z / a); elseif (t <= 1.3e+168) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.8e-52], y, If[LessEqual[t, -3.05e-214], x, If[LessEqual[t, 1.85e-44], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.3e+168], x, y]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{-52}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq -3.05 \cdot 10^{-214}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.85 \cdot 10^{-44}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{elif}\;t \leq 1.3 \cdot 10^{+168}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -1.79999999999999994e-52 or 1.3e168 < t Initial program 51.0%
Taylor expanded in t around inf
Applied rewrites41.6%
if -1.79999999999999994e-52 < t < -3.05e-214 or 1.85e-44 < t < 1.3e168Initial program 77.0%
Taylor expanded in a around inf
Applied rewrites38.1%
if -3.05e-214 < t < 1.85e-44Initial program 92.0%
Taylor expanded in x around 0
Applied rewrites48.8%
Taylor expanded in t around 0
Applied rewrites41.7%
(FPCore (x y z t a) :precision binary64 (if (<= a -3.3e-24) (fma (/ z a) (- y x) x) (if (<= a 4.8e+54) (fma (- z) (/ (- y x) t) y) (fma (/ (- z t) a) y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.3e-24) {
tmp = fma((z / a), (y - x), x);
} else if (a <= 4.8e+54) {
tmp = fma(-z, ((y - x) / t), y);
} else {
tmp = fma(((z - t) / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.3e-24) tmp = fma(Float64(z / a), Float64(y - x), x); elseif (a <= 4.8e+54) tmp = fma(Float64(-z), Float64(Float64(y - x) / t), y); else tmp = fma(Float64(Float64(z - t) / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.3e-24], N[(N[(z / a), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 4.8e+54], N[((-z) * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] + y), $MachinePrecision], N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.3 \cdot 10^{-24}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y - x, x\right)\\
\mathbf{elif}\;a \leq 4.8 \cdot 10^{+54}:\\
\;\;\;\;\mathsf{fma}\left(-z, \frac{y - x}{t}, y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a}, y, x\right)\\
\end{array}
\end{array}
if a < -3.29999999999999984e-24Initial program 73.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6490.8
Applied rewrites90.8%
Taylor expanded in t around 0
Applied rewrites69.5%
if -3.29999999999999984e-24 < a < 4.79999999999999997e54Initial program 70.9%
Taylor expanded in t around inf
Applied rewrites60.6%
Taylor expanded in a around 0
Applied rewrites77.6%
if 4.79999999999999997e54 < a Initial program 67.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.5
Applied rewrites91.5%
Taylor expanded in x around 0
Applied rewrites77.8%
Taylor expanded in t around 0
Applied rewrites67.0%
(FPCore (x y z t a) :precision binary64 (if (<= a -6.8e-167) (fma (/ (- y x) a) z x) (if (<= a 2.6e+53) (* (- y) (/ (- z t) t)) (fma (/ (- z t) a) y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -6.8e-167) {
tmp = fma(((y - x) / a), z, x);
} else if (a <= 2.6e+53) {
tmp = -y * ((z - t) / t);
} else {
tmp = fma(((z - t) / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -6.8e-167) tmp = fma(Float64(Float64(y - x) / a), z, x); elseif (a <= 2.6e+53) tmp = Float64(Float64(-y) * Float64(Float64(z - t) / t)); else tmp = fma(Float64(Float64(z - t) / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -6.8e-167], N[(N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] * z + x), $MachinePrecision], If[LessEqual[a, 2.6e+53], N[((-y) * N[(N[(z - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.8 \cdot 10^{-167}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - x}{a}, z, x\right)\\
\mathbf{elif}\;a \leq 2.6 \cdot 10^{+53}:\\
\;\;\;\;\left(-y\right) \cdot \frac{z - t}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - t}{a}, y, x\right)\\
\end{array}
\end{array}
if a < -6.7999999999999995e-167Initial program 76.1%
Taylor expanded in t around 0
Applied rewrites61.2%
if -6.7999999999999995e-167 < a < 2.59999999999999998e53Initial program 67.9%
Taylor expanded in x around 0
Applied rewrites54.8%
Taylor expanded in a around 0
Applied rewrites57.1%
if 2.59999999999999998e53 < a Initial program 67.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.5
Applied rewrites91.5%
Taylor expanded in x around 0
Applied rewrites77.8%
Taylor expanded in t around 0
Applied rewrites67.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.52e-21) (not (<= t 1.3e+168))) y (fma (/ (- y x) a) z x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.52e-21) || !(t <= 1.3e+168)) {
tmp = y;
} else {
tmp = fma(((y - x) / a), z, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.52e-21) || !(t <= 1.3e+168)) tmp = y; else tmp = fma(Float64(Float64(y - x) / a), z, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.52e-21], N[Not[LessEqual[t, 1.3e+168]], $MachinePrecision]], y, N[(N[(N[(y - x), $MachinePrecision] / a), $MachinePrecision] * z + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.52 \cdot 10^{-21} \lor \neg \left(t \leq 1.3 \cdot 10^{+168}\right):\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - x}{a}, z, x\right)\\
\end{array}
\end{array}
if t < -1.52000000000000009e-21 or 1.3e168 < t Initial program 47.5%
Taylor expanded in t around inf
Applied rewrites43.4%
if -1.52000000000000009e-21 < t < 1.3e168Initial program 83.7%
Taylor expanded in t around 0
Applied rewrites66.6%
Final simplification58.2%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.52e-21) y (if (<= t 1.45e+170) (fma (/ z a) y x) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.52e-21) {
tmp = y;
} else if (t <= 1.45e+170) {
tmp = fma((z / a), y, x);
} else {
tmp = y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.52e-21) tmp = y; elseif (t <= 1.45e+170) tmp = fma(Float64(z / a), y, x); else tmp = y; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.52e-21], y, If[LessEqual[t, 1.45e+170], N[(N[(z / a), $MachinePrecision] * y + x), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.52 \cdot 10^{-21}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 1.45 \cdot 10^{+170}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -1.52000000000000009e-21 or 1.45e170 < t Initial program 47.5%
Taylor expanded in t around inf
Applied rewrites43.4%
if -1.52000000000000009e-21 < t < 1.45e170Initial program 83.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.1
Applied rewrites91.1%
Taylor expanded in t around 0
Applied rewrites65.4%
Taylor expanded in x around 0
Applied rewrites54.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.52e-21) y (if (<= t 1.45e+170) (fma z (/ y a) x) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.52e-21) {
tmp = y;
} else if (t <= 1.45e+170) {
tmp = fma(z, (y / a), x);
} else {
tmp = y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.52e-21) tmp = y; elseif (t <= 1.45e+170) tmp = fma(z, Float64(y / a), x); else tmp = y; end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.52e-21], y, If[LessEqual[t, 1.45e+170], N[(z * N[(y / a), $MachinePrecision] + x), $MachinePrecision], y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.52 \cdot 10^{-21}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 1.45 \cdot 10^{+170}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -1.52000000000000009e-21 or 1.45e170 < t Initial program 47.5%
Taylor expanded in t around inf
Applied rewrites43.4%
if -1.52000000000000009e-21 < t < 1.45e170Initial program 83.7%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.1
Applied rewrites91.1%
Taylor expanded in t around 0
Applied rewrites66.6%
Taylor expanded in x around 0
Applied rewrites53.0%
Final simplification49.5%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.8e-52) y (if (<= t 1.3e+168) x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.8e-52) {
tmp = y;
} else if (t <= 1.3e+168) {
tmp = x;
} else {
tmp = 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, a)
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), intent (in) :: a
real(8) :: tmp
if (t <= (-1.8d-52)) then
tmp = y
else if (t <= 1.3d+168) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.8e-52) {
tmp = y;
} else if (t <= 1.3e+168) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.8e-52: tmp = y elif t <= 1.3e+168: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.8e-52) tmp = y; elseif (t <= 1.3e+168) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.8e-52) tmp = y; elseif (t <= 1.3e+168) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.8e-52], y, If[LessEqual[t, 1.3e+168], x, y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.8 \cdot 10^{-52}:\\
\;\;\;\;y\\
\mathbf{elif}\;t \leq 1.3 \cdot 10^{+168}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if t < -1.79999999999999994e-52 or 1.3e168 < t Initial program 51.0%
Taylor expanded in t around inf
Applied rewrites41.6%
if -1.79999999999999994e-52 < t < 1.3e168Initial program 84.1%
Taylor expanded in a around inf
Applied rewrites33.5%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return 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, a)
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), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 70.5%
Taylor expanded in a around inf
Applied rewrites24.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ (- y x) 1.0) (/ (- z t) (- a t))))))
(if (< a -1.6153062845442575e-142)
t_1
(if (< a 3.774403170083174e-182) (- y (* (/ z t) (- y x))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - x));
} else {
tmp = t_1;
}
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, a)
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), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (((y - x) / 1.0d0) * ((z - t) / (a - t)))
if (a < (-1.6153062845442575d-142)) then
tmp = t_1
else if (a < 3.774403170083174d-182) then
tmp = y - ((z / t) * (y - x))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t)));
double tmp;
if (a < -1.6153062845442575e-142) {
tmp = t_1;
} else if (a < 3.774403170083174e-182) {
tmp = y - ((z / t) * (y - x));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))) tmp = 0 if a < -1.6153062845442575e-142: tmp = t_1 elif a < 3.774403170083174e-182: tmp = y - ((z / t) * (y - x)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - x) / 1.0) * Float64(Float64(z - t) / Float64(a - t)))) tmp = 0.0 if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = Float64(y - Float64(Float64(z / t) * Float64(y - x))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - x) / 1.0) * ((z - t) / (a - t))); tmp = 0.0; if (a < -1.6153062845442575e-142) tmp = t_1; elseif (a < 3.774403170083174e-182) tmp = y - ((z / t) * (y - x)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] / 1.0), $MachinePrecision] * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[a, -1.6153062845442575e-142], t$95$1, If[Less[a, 3.774403170083174e-182], N[(y - N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;a < -1.6153062845442575 \cdot 10^{-142}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a < 3.774403170083174 \cdot 10^{-182}:\\
\;\;\;\;y - \frac{z}{t} \cdot \left(y - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2025019
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (if (< a -646122513817703/4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))) (if (< a 1887201585041587/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))))))
(+ x (/ (* (- y x) (- z t)) (- a t))))