From cca0de9b39daebb17a7ac38060d4164b150c23c6 Mon Sep 17 00:00:00 2001 From: HuangRui Date: Thu, 5 Feb 2015 10:20:20 +0800 Subject: [PATCH] Align the code of c_math.c --- app/include/user_config.h | 1 - app/libc/c_math.c | 88 ++++++++++++++++++++------------------- 2 files changed, 45 insertions(+), 44 deletions(-) diff --git a/app/include/user_config.h b/app/include/user_config.h index 6dd40d7c..f8e57477 100644 --- a/app/include/user_config.h +++ b/app/include/user_config.h @@ -40,7 +40,6 @@ #define ICACHE_STORE_TYPEDEF_ATTR __attribute__((aligned(4),packed)) #define ICACHE_STORE_ATTR __attribute__((aligned(4))) #define ICACHE_RAM_ATTR __attribute__((section(".iram0.text"))) -// #define ICACHE_RODATA_ATTR __attribute__((section(".rodata2.text"))) #define CLIENT_SSL_ENABLE #define GPIO_INTERRUPT_ENABLE diff --git a/app/libc/c_math.c b/app/libc/c_math.c index 97b60797..ae44335f 100644 --- a/app/libc/c_math.c +++ b/app/libc/c_math.c @@ -9,49 +9,51 @@ double floor(double x) #define MAXEXP 2031 /* (MAX_EXP * 16) - 1 */ #define MINEXP -2047 /* (MIN_EXP * 16) - 1 */ #define HUGE MAXFLOAT - double a1[] = - { - 1.0, - 0.95760328069857365, - 0.91700404320467123, - 0.87812608018664974, - 0.84089641525371454, - 0.80524516597462716, - 0.77110541270397041, - 0.73841307296974966, - 0.70710678118654752, - 0.67712777346844637, - 0.64841977732550483, - 0.62092890603674203, - 0.59460355750136054, - 0.56939431737834583, - 0.54525386633262883, - 0.52213689121370692, - 0.50000000000000000 - }; - double a2[] = - { - 0.24114209503420288E-17, - 0.92291566937243079E-18, - -0.15241915231122319E-17, - -0.35421849765286817E-17, - -0.31286215245415074E-17, - -0.44654376565694490E-17, - 0.29306999570789681E-17, - 0.11260851040933474E-17 - }; - double p1 = 0.833333333333332114e-1; - double p2 = 0.125000000005037992e-1; - double p3 = 0.223214212859242590e-2; - double p4 = 0.434457756721631196e-3; - double q1 = 0.693147180559945296e0; - double q2 = 0.240226506959095371e0; - double q3 = 0.555041086640855953e-1; - double q4 = 0.961812905951724170e-2; - double q5 = 0.133335413135857847e-2; - double q6 = 0.154002904409897646e-3; - double q7 = 0.149288526805956082e-4; - double k = 0.442695040888963407; + +double a1[] = +{ + 1.0, + 0.95760328069857365, + 0.91700404320467123, + 0.87812608018664974, + 0.84089641525371454, + 0.80524516597462716, + 0.77110541270397041, + 0.73841307296974966, + 0.70710678118654752, + 0.67712777346844637, + 0.64841977732550483, + 0.62092890603674203, + 0.59460355750136054, + 0.56939431737834583, + 0.54525386633262883, + 0.52213689121370692, + 0.50000000000000000 +}; +double a2[] = +{ + 0.24114209503420288E-17, + 0.92291566937243079E-18, + -0.15241915231122319E-17, + -0.35421849765286817E-17, + -0.31286215245415074E-17, + -0.44654376565694490E-17, + 0.29306999570789681E-17, + 0.11260851040933474E-17 +}; +double p1 = 0.833333333333332114e-1; +double p2 = 0.125000000005037992e-1; +double p3 = 0.223214212859242590e-2; +double p4 = 0.434457756721631196e-3; +double q1 = 0.693147180559945296e0; +double q2 = 0.240226506959095371e0; +double q3 = 0.555041086640855953e-1; +double q4 = 0.961812905951724170e-2; +double q5 = 0.133335413135857847e-2; +double q6 = 0.154002904409897646e-3; +double q7 = 0.149288526805956082e-4; +double k = 0.442695040888963407; + double pow(double x, double y) { double frexp(), g, ldexp(), r, u1, u2, v, w, w1, w2, y1, y2, z;