
(FPCore (c x y) :precision binary64 :pre TRUE (* c (log (+ 1.0 (* (- (pow E x) 1.0) y)))))
double code(double c, double x, double y) {
return c * log((1.0 + ((pow(((double) M_E), x) - 1.0) * y)));
}
public static double code(double c, double x, double y) {
return c * Math.log((1.0 + ((Math.pow(Math.E, x) - 1.0) * y)));
}
def code(c, x, y): return c * math.log((1.0 + ((math.pow(math.e, x) - 1.0) * y)))
function code(c, x, y) return Float64(c * log(Float64(1.0 + Float64(Float64((exp(1) ^ x) - 1.0) * y)))) end
function tmp = code(c, x, y) tmp = c * log((1.0 + (((2.71828182845904523536 ^ x) - 1.0) * y))); end
code[c_, x_, y_] := N[(c * N[Log[N[(1.0 + N[(N[(N[Power[E, x], $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = c * (ln(((1) + (((exp(1) ^ x) - (1)) * y)))) END code
c \cdot \log \left(1 + \left({e}^{x} - 1\right) \cdot y\right)
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (c x y) :precision binary64 :pre TRUE (* c (log (+ 1.0 (* (- (pow E x) 1.0) y)))))
double code(double c, double x, double y) {
return c * log((1.0 + ((pow(((double) M_E), x) - 1.0) * y)));
}
public static double code(double c, double x, double y) {
return c * Math.log((1.0 + ((Math.pow(Math.E, x) - 1.0) * y)));
}
def code(c, x, y): return c * math.log((1.0 + ((math.pow(math.e, x) - 1.0) * y)))
function code(c, x, y) return Float64(c * log(Float64(1.0 + Float64(Float64((exp(1) ^ x) - 1.0) * y)))) end
function tmp = code(c, x, y) tmp = c * log((1.0 + (((2.71828182845904523536 ^ x) - 1.0) * y))); end
code[c_, x_, y_] := N[(c * N[Log[N[(1.0 + N[(N[(N[Power[E, x], $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = c * (ln(((1) + (((exp(1) ^ x) - (1)) * y)))) END code
c \cdot \log \left(1 + \left({e}^{x} - 1\right) \cdot y\right)
(FPCore (c x y)
:precision binary64
:pre TRUE
(if (<= y -5.0526870964395696e-21)
(* c (log1p (* y (expm1 x))))
(if (<= y 2.89746434286162e+41)
(* y (fma -0.5 (* c (* y (pow (expm1 x) 2.0))) (* c (expm1 x))))
(* c (log1p (* x y))))))double code(double c, double x, double y) {
double tmp;
if (y <= -5.0526870964395696e-21) {
tmp = c * log1p((y * expm1(x)));
} else if (y <= 2.89746434286162e+41) {
tmp = y * fma(-0.5, (c * (y * pow(expm1(x), 2.0))), (c * expm1(x)));
} else {
tmp = c * log1p((x * y));
}
return tmp;
}
function code(c, x, y) tmp = 0.0 if (y <= -5.0526870964395696e-21) tmp = Float64(c * log1p(Float64(y * expm1(x)))); elseif (y <= 2.89746434286162e+41) tmp = Float64(y * fma(-0.5, Float64(c * Float64(y * (expm1(x) ^ 2.0))), Float64(c * expm1(x)))); else tmp = Float64(c * log1p(Float64(x * y))); end return tmp end
code[c_, x_, y_] := If[LessEqual[y, -5.0526870964395696e-21], N[(c * N[Log[1 + N[(y * N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.89746434286162e+41], N[(y * N[(-0.5 * N[(c * N[(y * N[Power[N[(Exp[x] - 1), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c * N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * N[Log[1 + N[(x * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = LET tmp_1 = IF (y <= (289746434286162010702981045571855604252672)) THEN (y * (((-5e-1) * (c * (y * (((exp(x)) - (1)) ^ (2))))) + (c * ((exp(x)) - (1))))) ELSE (c * (ln(((x * y) + (1))))) ENDIF IN LET tmp = IF (y <= (-5052687096439569569243335779354560956868657595132130201892421694775947571542928926646709442138671875e-120)) THEN (c * (ln(((y * ((exp(x)) - (1))) + (1))))) ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;y \leq -5.0526870964395696 \cdot 10^{-21}:\\
\;\;\;\;c \cdot \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right)\\
\mathbf{elif}\;y \leq 2.89746434286162 \cdot 10^{+41}:\\
\;\;\;\;y \cdot \mathsf{fma}\left(-0.5, c \cdot \left(y \cdot {\left(\mathsf{expm1}\left(x\right)\right)}^{2}\right), c \cdot \mathsf{expm1}\left(x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot \mathsf{log1p}\left(x \cdot y\right)\\
\end{array}
if y < -5.0526870964395696e-21Initial program 42.7%
Applied rewrites93.9%
if -5.0526870964395696e-21 < y < 2.8974643428616201e41Initial program 42.7%
Taylor expanded in y around 0
Applied rewrites75.9%
if 2.8974643428616201e41 < y Initial program 42.7%
Applied rewrites93.9%
Taylor expanded in x around 0
Applied rewrites66.7%
(FPCore (c x y)
:precision binary64
:pre TRUE
(let* ((t_0 (* c (log1p (* y (expm1 x))))))
(if (<= y -9.807937393992035e-23)
t_0
(if (<= y 4.316254692990626e-138)
(/ 1.0 (/ (fma 0.5 (/ y c) (/ 1.0 (* c (expm1 x)))) y))
t_0))))double code(double c, double x, double y) {
double t_0 = c * log1p((y * expm1(x)));
double tmp;
if (y <= -9.807937393992035e-23) {
tmp = t_0;
} else if (y <= 4.316254692990626e-138) {
tmp = 1.0 / (fma(0.5, (y / c), (1.0 / (c * expm1(x)))) / y);
} else {
tmp = t_0;
}
return tmp;
}
function code(c, x, y) t_0 = Float64(c * log1p(Float64(y * expm1(x)))) tmp = 0.0 if (y <= -9.807937393992035e-23) tmp = t_0; elseif (y <= 4.316254692990626e-138) tmp = Float64(1.0 / Float64(fma(0.5, Float64(y / c), Float64(1.0 / Float64(c * expm1(x)))) / y)); else tmp = t_0; end return tmp end
code[c_, x_, y_] := Block[{t$95$0 = N[(c * N[Log[1 + N[(y * N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -9.807937393992035e-23], t$95$0, If[LessEqual[y, 4.316254692990626e-138], N[(1.0 / N[(N[(0.5 * N[(y / c), $MachinePrecision] + N[(1.0 / N[(c * N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = LET t_0 = (c * (ln(((y * ((exp(x)) - (1))) + (1))))) IN LET tmp_1 = IF (y <= (43162546929906259134750961636753791522490051043582140858254171294643363998531943107306417950012768569703195295980549658576522852115219630559900687347501694392507682470931681059819846607403220998685358214209311394774201867168052405293067855904333603405413411642577151394200825670600553206240045871610343862931618164687459720144460141588726997952107922174036502838134765625e-508)) THEN ((1) / ((((5e-1) * (y / c)) + ((1) / (c * ((exp(x)) - (1))))) / y)) ELSE t_0 ENDIF IN LET tmp = IF (y <= (-98079373939920354457392020799073677688248770787500878984193687128156913246357362368144094944000244140625e-126)) THEN t_0 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_0 := c \cdot \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right)\\
\mathbf{if}\;y \leq -9.807937393992035 \cdot 10^{-23}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 4.316254692990626 \cdot 10^{-138}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(0.5, \frac{y}{c}, \frac{1}{c \cdot \mathsf{expm1}\left(x\right)}\right)}{y}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -9.8079373939920354e-23 or 4.3162546929906259e-138 < y Initial program 42.7%
Applied rewrites93.9%
if -9.8079373939920354e-23 < y < 4.3162546929906259e-138Initial program 42.7%
Applied rewrites52.8%
Taylor expanded in y around 0
Applied rewrites76.3%
(FPCore (c x y) :precision binary64 :pre TRUE (* c (log1p (* y (expm1 x)))))
double code(double c, double x, double y) {
return c * log1p((y * expm1(x)));
}
public static double code(double c, double x, double y) {
return c * Math.log1p((y * Math.expm1(x)));
}
def code(c, x, y): return c * math.log1p((y * math.expm1(x)))
function code(c, x, y) return Float64(c * log1p(Float64(y * expm1(x)))) end
code[c_, x_, y_] := N[(c * N[Log[1 + N[(y * N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = c * (ln(((y * ((exp(x)) - (1))) + (1)))) END code
c \cdot \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right)
Initial program 42.7%
Applied rewrites93.9%
(FPCore (c x y)
:precision binary64
:pre TRUE
(let* ((t_0 (* (- (pow E x) 1.0) y))
(t_1 (* y (expm1 x)))
(t_2 (* c t_1)))
(if (<= t_0 -5e-298)
t_2
(if (<= t_0 0.0)
(* c (log1p (* x y)))
(if (<= t_0 1e-20) t_2 (* c (log (+ 1.0 t_1))))))))double code(double c, double x, double y) {
double t_0 = (pow(((double) M_E), x) - 1.0) * y;
double t_1 = y * expm1(x);
double t_2 = c * t_1;
double tmp;
if (t_0 <= -5e-298) {
tmp = t_2;
} else if (t_0 <= 0.0) {
tmp = c * log1p((x * y));
} else if (t_0 <= 1e-20) {
tmp = t_2;
} else {
tmp = c * log((1.0 + t_1));
}
return tmp;
}
public static double code(double c, double x, double y) {
double t_0 = (Math.pow(Math.E, x) - 1.0) * y;
double t_1 = y * Math.expm1(x);
double t_2 = c * t_1;
double tmp;
if (t_0 <= -5e-298) {
tmp = t_2;
} else if (t_0 <= 0.0) {
tmp = c * Math.log1p((x * y));
} else if (t_0 <= 1e-20) {
tmp = t_2;
} else {
tmp = c * Math.log((1.0 + t_1));
}
return tmp;
}
def code(c, x, y): t_0 = (math.pow(math.e, x) - 1.0) * y t_1 = y * math.expm1(x) t_2 = c * t_1 tmp = 0 if t_0 <= -5e-298: tmp = t_2 elif t_0 <= 0.0: tmp = c * math.log1p((x * y)) elif t_0 <= 1e-20: tmp = t_2 else: tmp = c * math.log((1.0 + t_1)) return tmp
function code(c, x, y) t_0 = Float64(Float64((exp(1) ^ x) - 1.0) * y) t_1 = Float64(y * expm1(x)) t_2 = Float64(c * t_1) tmp = 0.0 if (t_0 <= -5e-298) tmp = t_2; elseif (t_0 <= 0.0) tmp = Float64(c * log1p(Float64(x * y))); elseif (t_0 <= 1e-20) tmp = t_2; else tmp = Float64(c * log(Float64(1.0 + t_1))); end return tmp end
code[c_, x_, y_] := Block[{t$95$0 = N[(N[(N[Power[E, x], $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$1 = N[(y * N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-298], t$95$2, If[LessEqual[t$95$0, 0.0], N[(c * N[Log[1 + N[(x * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e-20], t$95$2, N[(c * N[Log[N[(1.0 + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = LET t_0 = (((exp(1) ^ x) - (1)) * y) IN LET t_1 = (y * ((exp(x)) - (1))) IN LET t_2 = (c * t_1) IN LET tmp_2 = IF (t_0 <= (999999999999999945153271454209571651729503702787392447107715776066783064379706047475337982177734375e-119)) THEN t_2 ELSE (c * (ln(((1) + t_1)))) ENDIF IN LET tmp_1 = IF (t_0 <= (0)) THEN (c * (ln(((x * y) + (1))))) ELSE tmp_2 ENDIF IN LET tmp = IF (t_0 <= (-50000000000000001982390644904750342604344976744413298494950562196277733647913263354085416170701413416587482141050174570103203745155038199457815485879520927687658817543265892818055505600366265121512124490482615971985351334892628922808921216240418532506399220110685405927928678061115147014459489825763506350048574679343828723173506118139614887358828912221955289065532975585659327356400186103927645009176862381231667469142345370713262542047925084540767618800467004713807463374175907492258376939079308940167623230277975888456401619903834228747542854421482305127458171205361949324887940898384829500963136605503399629098165163649224581843201615647303257129475114053499162703554938832017195649960002880234717810570277407578032580204308032989501953125e-1040)) THEN t_2 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_0 := \left({e}^{x} - 1\right) \cdot y\\
t_1 := y \cdot \mathsf{expm1}\left(x\right)\\
t_2 := c \cdot t\_1\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-298}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;c \cdot \mathsf{log1p}\left(x \cdot y\right)\\
\mathbf{elif}\;t\_0 \leq 10^{-20}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;c \cdot \log \left(1 + t\_1\right)\\
\end{array}
if (*.f64 (-.f64 (pow.f64 (E.f64) x) #s(literal 1 binary64)) y) < -5.0000000000000002e-298 or 0.0 < (*.f64 (-.f64 (pow.f64 (E.f64) x) #s(literal 1 binary64)) y) < 9.9999999999999995e-21Initial program 42.7%
Taylor expanded in y around 0
Applied rewrites73.8%
if -5.0000000000000002e-298 < (*.f64 (-.f64 (pow.f64 (E.f64) x) #s(literal 1 binary64)) y) < 0.0Initial program 42.7%
Applied rewrites93.9%
Taylor expanded in x around 0
Applied rewrites66.7%
if 9.9999999999999995e-21 < (*.f64 (-.f64 (pow.f64 (E.f64) x) #s(literal 1 binary64)) y) Initial program 42.7%
Taylor expanded in x around 0
Applied rewrites56.3%
Taylor expanded in c around 0
Applied rewrites52.9%
(FPCore (c x y) :precision binary64 :pre TRUE (if (<= x -486340733203.483) (* c (* y (expm1 x))) (* c (log1p (* x y)))))
double code(double c, double x, double y) {
double tmp;
if (x <= -486340733203.483) {
tmp = c * (y * expm1(x));
} else {
tmp = c * log1p((x * y));
}
return tmp;
}
public static double code(double c, double x, double y) {
double tmp;
if (x <= -486340733203.483) {
tmp = c * (y * Math.expm1(x));
} else {
tmp = c * Math.log1p((x * y));
}
return tmp;
}
def code(c, x, y): tmp = 0 if x <= -486340733203.483: tmp = c * (y * math.expm1(x)) else: tmp = c * math.log1p((x * y)) return tmp
function code(c, x, y) tmp = 0.0 if (x <= -486340733203.483) tmp = Float64(c * Float64(y * expm1(x))); else tmp = Float64(c * log1p(Float64(x * y))); end return tmp end
code[c_, x_, y_] := If[LessEqual[x, -486340733203.483], N[(c * N[(y * N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * N[Log[1 + N[(x * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = LET tmp = IF (x <= (-48634073320348297119140625e-14)) THEN (c * (y * ((exp(x)) - (1)))) ELSE (c * (ln(((x * y) + (1))))) ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;x \leq -486340733203.483:\\
\;\;\;\;c \cdot \left(y \cdot \mathsf{expm1}\left(x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot \mathsf{log1p}\left(x \cdot y\right)\\
\end{array}
if x < -486340733203.48297Initial program 42.7%
Taylor expanded in y around 0
Applied rewrites73.8%
if -486340733203.48297 < x Initial program 42.7%
Applied rewrites93.9%
Taylor expanded in x around 0
Applied rewrites66.7%
(FPCore (c x y) :precision binary64 :pre TRUE (if (<= y -3.121246976337799e+208) (* c (log (+ 1.0 (* x y)))) (* c (* y (expm1 x)))))
double code(double c, double x, double y) {
double tmp;
if (y <= -3.121246976337799e+208) {
tmp = c * log((1.0 + (x * y)));
} else {
tmp = c * (y * expm1(x));
}
return tmp;
}
public static double code(double c, double x, double y) {
double tmp;
if (y <= -3.121246976337799e+208) {
tmp = c * Math.log((1.0 + (x * y)));
} else {
tmp = c * (y * Math.expm1(x));
}
return tmp;
}
def code(c, x, y): tmp = 0 if y <= -3.121246976337799e+208: tmp = c * math.log((1.0 + (x * y))) else: tmp = c * (y * math.expm1(x)) return tmp
function code(c, x, y) tmp = 0.0 if (y <= -3.121246976337799e+208) tmp = Float64(c * log(Float64(1.0 + Float64(x * y)))); else tmp = Float64(c * Float64(y * expm1(x))); end return tmp end
code[c_, x_, y_] := If[LessEqual[y, -3.121246976337799e+208], N[(c * N[Log[N[(1.0 + N[(x * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c * N[(y * N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = LET tmp = IF (y <= (-31212469763377991858268418725924515972253535060150095710701259542669167879844506546737356652932243176663819876203166475836890353901674260976380972794288313308229939374615769672701172111301194693603814012878848)) THEN (c * (ln(((1) + (x * y))))) ELSE (c * (y * ((exp(x)) - (1)))) ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;y \leq -3.121246976337799 \cdot 10^{+208}:\\
\;\;\;\;c \cdot \log \left(1 + x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(y \cdot \mathsf{expm1}\left(x\right)\right)\\
\end{array}
if y < -3.1212469763377992e208Initial program 42.7%
Taylor expanded in x around 0
Applied rewrites41.2%
if -3.1212469763377992e208 < y Initial program 42.7%
Taylor expanded in y around 0
Applied rewrites73.8%
(FPCore (c x y) :precision binary64 :pre TRUE (if (<= x -1.8686192561700437e-34) (* c (* y (expm1 x))) (* (* y c) x)))
double code(double c, double x, double y) {
double tmp;
if (x <= -1.8686192561700437e-34) {
tmp = c * (y * expm1(x));
} else {
tmp = (y * c) * x;
}
return tmp;
}
public static double code(double c, double x, double y) {
double tmp;
if (x <= -1.8686192561700437e-34) {
tmp = c * (y * Math.expm1(x));
} else {
tmp = (y * c) * x;
}
return tmp;
}
def code(c, x, y): tmp = 0 if x <= -1.8686192561700437e-34: tmp = c * (y * math.expm1(x)) else: tmp = (y * c) * x return tmp
function code(c, x, y) tmp = 0.0 if (x <= -1.8686192561700437e-34) tmp = Float64(c * Float64(y * expm1(x))); else tmp = Float64(Float64(y * c) * x); end return tmp end
code[c_, x_, y_] := If[LessEqual[x, -1.8686192561700437e-34], N[(c * N[(y * N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * c), $MachinePrecision] * x), $MachinePrecision]]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = LET tmp = IF (x <= (-186861925617004372032854153289757083322071255081998442792221323882068610656778446061919191252542749026588353444822132587432861328125e-165)) THEN (c * (y * ((exp(x)) - (1)))) ELSE ((y * c) * x) ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;x \leq -1.8686192561700437 \cdot 10^{-34}:\\
\;\;\;\;c \cdot \left(y \cdot \mathsf{expm1}\left(x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot c\right) \cdot x\\
\end{array}
if x < -1.8686192561700437e-34Initial program 42.7%
Taylor expanded in y around 0
Applied rewrites73.8%
if -1.8686192561700437e-34 < x Initial program 42.7%
Taylor expanded in x around 0
Applied rewrites56.3%
Applied rewrites61.7%
(FPCore (c x y) :precision binary64 :pre TRUE (* (* y c) x))
double code(double c, double x, double y) {
return (y * c) * x;
}
real(8) function code(c, x, y)
use fmin_fmax_functions
real(8), intent (in) :: c
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (y * c) * x
end function
public static double code(double c, double x, double y) {
return (y * c) * x;
}
def code(c, x, y): return (y * c) * x
function code(c, x, y) return Float64(Float64(y * c) * x) end
function tmp = code(c, x, y) tmp = (y * c) * x; end
code[c_, x_, y_] := N[(N[(y * c), $MachinePrecision] * x), $MachinePrecision]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = (y * c) * x END code
\left(y \cdot c\right) \cdot x
Initial program 42.7%
Taylor expanded in x around 0
Applied rewrites56.3%
Applied rewrites61.7%
(FPCore (c x y) :precision binary64 :pre TRUE (* (copysign 1.0 c) (if (<= (fabs c) 1.271917242250401e-38) (* (fabs c) (* x y)) (* (* x (fabs c)) y))))
double code(double c, double x, double y) {
double tmp;
if (fabs(c) <= 1.271917242250401e-38) {
tmp = fabs(c) * (x * y);
} else {
tmp = (x * fabs(c)) * y;
}
return copysign(1.0, c) * tmp;
}
public static double code(double c, double x, double y) {
double tmp;
if (Math.abs(c) <= 1.271917242250401e-38) {
tmp = Math.abs(c) * (x * y);
} else {
tmp = (x * Math.abs(c)) * y;
}
return Math.copySign(1.0, c) * tmp;
}
def code(c, x, y): tmp = 0 if math.fabs(c) <= 1.271917242250401e-38: tmp = math.fabs(c) * (x * y) else: tmp = (x * math.fabs(c)) * y return math.copysign(1.0, c) * tmp
function code(c, x, y) tmp = 0.0 if (abs(c) <= 1.271917242250401e-38) tmp = Float64(abs(c) * Float64(x * y)); else tmp = Float64(Float64(x * abs(c)) * y); end return Float64(copysign(1.0, c) * tmp) end
function tmp_2 = code(c, x, y) tmp = 0.0; if (abs(c) <= 1.271917242250401e-38) tmp = abs(c) * (x * y); else tmp = (x * abs(c)) * y; end tmp_2 = (sign(c) * abs(1.0)) * tmp; end
code[c_, x_, y_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[c], $MachinePrecision], 1.271917242250401e-38], N[(N[Abs[c], $MachinePrecision] * N[(x * y), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[Abs[c], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, c\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|c\right| \leq 1.271917242250401 \cdot 10^{-38}:\\
\;\;\;\;\left|c\right| \cdot \left(x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left|c\right|\right) \cdot y\\
\end{array}
if c < 1.271917242250401e-38Initial program 42.7%
Taylor expanded in x around 0
Applied rewrites56.3%
if 1.271917242250401e-38 < c Initial program 42.7%
Taylor expanded in x around 0
Applied rewrites56.3%
Applied rewrites58.9%
(FPCore (c x y) :precision binary64 :pre TRUE (if (<= x -7.432363882505071e+31) (* 0.0 (* x y)) (* c (* x y))))
double code(double c, double x, double y) {
double tmp;
if (x <= -7.432363882505071e+31) {
tmp = 0.0 * (x * y);
} else {
tmp = c * (x * y);
}
return tmp;
}
real(8) function code(c, x, y)
use fmin_fmax_functions
real(8), intent (in) :: c
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-7.432363882505071d+31)) then
tmp = 0.0d0 * (x * y)
else
tmp = c * (x * y)
end if
code = tmp
end function
public static double code(double c, double x, double y) {
double tmp;
if (x <= -7.432363882505071e+31) {
tmp = 0.0 * (x * y);
} else {
tmp = c * (x * y);
}
return tmp;
}
def code(c, x, y): tmp = 0 if x <= -7.432363882505071e+31: tmp = 0.0 * (x * y) else: tmp = c * (x * y) return tmp
function code(c, x, y) tmp = 0.0 if (x <= -7.432363882505071e+31) tmp = Float64(0.0 * Float64(x * y)); else tmp = Float64(c * Float64(x * y)); end return tmp end
function tmp_2 = code(c, x, y) tmp = 0.0; if (x <= -7.432363882505071e+31) tmp = 0.0 * (x * y); else tmp = c * (x * y); end tmp_2 = tmp; end
code[c_, x_, y_] := If[LessEqual[x, -7.432363882505071e+31], N[(0.0 * N[(x * y), $MachinePrecision]), $MachinePrecision], N[(c * N[(x * y), $MachinePrecision]), $MachinePrecision]]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = LET tmp = IF (x <= (-74323638825050714387306548035584)) THEN ((0) * (x * y)) ELSE (c * (x * y)) ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;x \leq -7.432363882505071 \cdot 10^{+31}:\\
\;\;\;\;0 \cdot \left(x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(x \cdot y\right)\\
\end{array}
if x < -7.4323638825050714e31Initial program 42.7%
Taylor expanded in x around 0
Applied rewrites56.3%
Taylor expanded in undef-var around zero
Applied rewrites31.5%
if -7.4323638825050714e31 < x Initial program 42.7%
Taylor expanded in x around 0
Applied rewrites56.3%
(FPCore (c x y) :precision binary64 :pre TRUE (* c (* x y)))
double code(double c, double x, double y) {
return c * (x * y);
}
real(8) function code(c, x, y)
use fmin_fmax_functions
real(8), intent (in) :: c
real(8), intent (in) :: x
real(8), intent (in) :: y
code = c * (x * y)
end function
public static double code(double c, double x, double y) {
return c * (x * y);
}
def code(c, x, y): return c * (x * y)
function code(c, x, y) return Float64(c * Float64(x * y)) end
function tmp = code(c, x, y) tmp = c * (x * y); end
code[c_, x_, y_] := N[(c * N[(x * y), $MachinePrecision]), $MachinePrecision]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = c * (x * y) END code
c \cdot \left(x \cdot y\right)
Initial program 42.7%
Taylor expanded in x around 0
Applied rewrites56.3%
(FPCore (c x y) :precision binary64 :pre TRUE (* c (log1p (* (expm1 x) y))))
double code(double c, double x, double y) {
return c * log1p((expm1(x) * y));
}
public static double code(double c, double x, double y) {
return c * Math.log1p((Math.expm1(x) * y));
}
def code(c, x, y): return c * math.log1p((math.expm1(x) * y))
function code(c, x, y) return Float64(c * log1p(Float64(expm1(x) * y))) end
code[c_, x_, y_] := N[(c * N[Log[1 + N[(N[(Exp[x] - 1), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = c * (ln(((((exp(x)) - (1)) * y) + (1)))) END code
c \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right)
herbie shell --seed 2026070
(FPCore (c x y)
:name "Logarithmic Transform"
:precision binary64
:alt
(* c (log1p (* (expm1 x) y)))
(* c (log (+ 1.0 (* (- (pow E x) 1.0) y)))))