admin 发布的文章

select product_id,survey_date+interval '1 DAYS'

 select * from (

    select *,

    case when last_week_avg_price=0 then 0 else (this_week_avg_price-last_week_avg_price)/last_week_avg_price*100 end  ringvalue,
    (select sum(cast(this_day_trading as double)) from dr_information_items  where good_id=v.good_id and date_week=to_char(to_date(#{surveyDateWeek},'yyyy-MM-dd')+interval '-7 DAYS', 'yyyy-mm-dd') group by good_id,date_week) lastWeekTrading
    from
    (

    SELECT
    min(dr.id) id,
    items.cateid AS class_code,
    min(items.good_name) AS class_name,
    min(items.good_id) AS good_id,
    min(items.product) AS product,
    sum(items.this_day_count_price) AS this_week_price,
    sum(cast(items.this_day_trading as double)) AS this_day_trading,
    case when sum(cast(items.this_day_trading as double))=0 then avg(items.last_week_avg_price)  else  sum(items.this_day_count_price)/sum(cast(items.this_day_trading as double)) end this_week_avg_price ,
    avg(items.last_week_avg_price) AS last_week_avg_price,
    min(items.unit) AS unit,
    max(u.user_name) shop_number
    FROM dr_information_items items
    left JOIN dr_information dr ON dr.id = items.infomationid
    left JOIN sys_user u on LTrim(RTrim(items.create_by))=cast(LTrim(RTrim(u.user_name)) as text)
    WHERE  items.date_week IS NOT NULL AND dr.status =#{status}
    <if test="marketId != null  and marketId != ''">
        and dr.market_id=#{marketId}
    </if>
    <if test="surveyDateWeek != null">
        and to_date(items.date_week,'YYYY-MM-DD')=#{surveyDateWeek}
    </if>
    GROUP BY items.date_week, items.cateid
    ) v
    ) t where 1=1
    <if test="classCode != null">
        and LEFT(class_code,4)=#{classCode}
    </if>
    <if test="ringvalue != null">
        and ringvalue <![CDATA[ >= ]]> #{ringvalue}
    </if>

    UNION

    select  id,class_id class_code,name class_name,'' good_id,'' product,null this_week_price,null this_day_trading,null this_week_avg_price,null last_week_avg_price,'' unit,'' shop_number,null ringvalue,null lastWeekTrading

    from dr_lybase_class where  LEFT(class_id,4)=#{classCode}  and LENGTH(class_id)=8 and  LEFT(class_id,8)  in (select LEFT(cateid,8) from   dr_information_items
     where  to_date(date_week,'YYYY-MM-DD')=#{surveyDateWeek})

    order by class_code

float: 10^38 1e+38

float:单精度类型,精度是8位有效数字,取值范围是10的-38次方到10的38次方,float占用4个字节的存储空间。
也就是说(1的后面38个零)

double:双精度类型,精度是17位有效数字,取值范围是10的-308次方到10的308次方,double占用8个字节的存储空间
也就是说(1的后面308个零)

网友1:
一般情况下float即可以满足实数计算要求,当你的精度要求非常小的时候,比如1e-6的时候就可以考虑用double了,float和double主要的区别就是精度问题

网友2:
类型 符号位 阶码 尾数 长度
float 1 8 23 32
double 1 11 52 64
double 和 float 的区别是 double 精度高,有效数字 16 位,float 精度 7 位。但 double 消耗内存是 float 的两倍,double 的运算速度比 float 慢得多,能用单精度时不要用双精度(以省内存,加快运算速度)。

#include <iostream>

include <iomanip>

using namespace std;

int main()
{

float a=12.257902012398877;
double b=12.257902012398877;
const float PI=3.1415926;         // 常量定义
cout<<setprecision(15)<<a<<endl;  // 只有6-7位有效数字,后面的就不精确
cout<<setprecision(15)<<b<<endl;  // 有15-16位有效数字,所以完全正确
cout<<setprecision(15)<<PI<<endl; 
return 0;

1·1右键git工程,进入git,选择Branches

微信截图_20240723150131.png

.拉取git远程分支

v1.png

可以看到当前分支

v11.png

点击Local中的V1.所修改代码即是V1分支的代码。