#include <stdio.h>
#include <math.h>
#include <iostream>
#include<cfloat>
using namespace std;
const int max_iterations=100;
const double interval = 0.001; // interval length for roots subdivision
bool is_root = false; // is false if function has a second type break in root candidate point
double delta; //precision of root search
double A, B;
double f(double x)//our function
{
double r = DBL_MAX;
try
{
r = x / (2*sin(x)+1) - tan(log(x*x+1));
}
catch(...)
{
//nothing to do for arithmetic exception
}
return r;
}
bool is_change_sign(double fa, double fb)
{
return fa*fb<0;
}
double find_root(double a, double b, double delta, bool *yes)
{
double fa;
double fb;
double fc;
double c;
int l=0;
fa=f(a);
fb=f(b);
double dy,dy1; //old and new OY projections of chord
dy=fabs(fa-fb);
dy1=DBL_MAX;
while(true)
{
l++;
if(l > max_iterations)
{
*yes=false;
return (a+b)/2;
}
c = a - (b - a) * fa/(fb - fa);
fc = f(c);
if(fa*fc>0)
{
a=c;
fa=fc;
}
else
{
b=c;
fb=fc;
}
if(fabs(fa)<delta)
{
*yes=true;
return a;
}
if(fabs(fb)<delta)
{
*yes=true;
return b;
}
if(l>10) //there's a magic number, we must check conditions of break or stop after some iterations(some = 10)
{
if(dy1>dy) //checking if there's break of second kind(pole)
{
*yes=false;
return (a+b)/2;
}
if(fabs(b-a)<delta) //else we are near the root
{
*yes=true;
return (a+b)/2;
}
}
dy=dy1; //change old chord height
dy1=fabs(fa-fb); //calculate new chord height
}
// we can't get here
*yes=false;
return c;
}
int main()
{
scanf("%lf %lf %lf",&A,&B,&delta);
double a,b;
double fa, fb;
/*
test interval for finding roots
int k=2;
A= sqrt(exp(M_PI*(1/2.0+k))-1)-M_PI;//70010637.8772-10;
B= sqrt(exp(M_PI*(1/2.0+k))-1)+M_PI;//70010637.8772+10;
delta = 1e-12;
printf("A=%20.19g A=%20.19g delta=%20.19g \n",A,B,delta);
*/
fb = f(A);
for(a = A, b = A + interval; b<=B; a += interval, b += interval)
{
fa = fb;
fb = f(b);
if(is_change_sign(fa,fb))
{
double r=find_root(a,b,delta, &is_root);
if(is_root)
{
printf("%14.15lf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