Floating-Point Hazard (数学定义QAQ)

题目描述
Given the value of low, high you will have to find the value of the following expression:


If you try to find the value of the above expression in a straightforward way, the answer may be incorrect due to precision error.

输入
The input file contains at most 2000 lines of inputs. Each line contains two integers which denote the value of low, high (1 ≤ low ≤ high ≤ 2000000000 and high-low ≤ 10000). Input is terminated by a line containing two zeroes. This line should not be processed.

输出
For each line of input produce one line of output. This line should contain the value of the expression above in exponential format. The mantissa part should have one digit before the decimal point and be rounded to five digits after the decimal point. To be more specific the output should be of the form d.dddddE-ddd, here d means a decimal digit and E means power of 10. Look at the output for sample input for details. Your output should follow the same pattern as shown below.

input
1 100
10000 20000
0 0
output
3.83346E-015
5.60041E-015
题意:
简单的来说就是根据那个公式去计算这个值,给你的是一个上、下限,然后根据这个求这个答案,然后最后的答案就要根据科学计数法来保四舍五入留最后5位
分析:
这样来看,好像没有什么思路(大佬看到这就可以走了d=====( ̄▽ ̄*)b),但是,小伙伴们对求导的定义式是否有什么印象呢????
下面我就将求导的定义式及其求导的过程给各位搬过来了( ̄▽ ̄):
考察下面(二元函数导数)的定义:
lim ⁡ △ t →   0 △ f △ t = lim ⁡ △ t →   0 f ( x + △ t ) − f ( x ) △ t = f ( x ) ′ \begin{matrix} \lim_{\triangle t \to \ 0} \frac{\triangle f}{\triangle t}=\end{matrix} \begin{matrix} \lim_{\triangle t \to \ 0} \frac{f(x+\triangle t)-f(x)}{\triangle t}=\end{matrix}f(x)\prime limt 0tf=limt 0tf(x+t)f(x)=f(x)
如果我们上述的题目所给的式子看成 f ( x ) = ( x 3 ) f(x)=(\sqrt[3]{x}) f(x)=(3x ) △ t = 1 0 − 15 \triangle t = 10^{-15} t=1015
这一题是不是就可以看成从题目给的下限到上限的求导的和了呢(最后的答案应该需要乘上 △ t \triangle t t

#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <cstring>
#include <cmath>
#include <queue>
#include <cstdio>
#include <vector>
#include <set>
#include <stack>
using namespace std;
typedef long long ll;
const int N = 1e6+10;
const int INF=0x3f3f3f3f;
const ll LINF=0x3f3f3f3f3f3f3f3f;
const int MOD=1e9+7;
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define Abs(x) ((x)>=0?(x):-(x))
double low,up;
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("in.txt","r",stdin);
    #endif // ONLINE_JUDGE
    while(scanf("%lf%lf",&low,&up)!=EOF,low+up){
        double t=1e-15;
        double ans=0;
        for(double i=low;i<=up;i++){
            ans+=pow(i,-0.66666666666);
        }
        ans*=0.333333333;
        printf("%.5fE-015\n",ans);
    }
    return 0;
 }

emmmmm,排版没有排好,下次改进ε=ε=ε=( ̄▽ ̄)

xilinx floating-point ip是指xilinx公司开发的用于浮点数数据处理的IP核。它可以实现浮点数的转换、 #### 引用[.reference_title] - *1* [十三、Xilinx floating-point IP 使用说明](https://blog.csdn.net/weixin_41838250/article/details/125874095)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [【教程】Xilinx FPGA里面的AXI DMA IP核的简单用法(以读写Floating-point IP核数据为例)](https://blog.csdn.net/ZLK1214/article/details/113144766)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [fp23fftk:最新的Xilinx FPGA的浮点正向反向快速傅立叶变换(FFT)IP内核(源语言-VHDL)](https://download.csdn.net/download/weixin_42102713/14990566)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值