ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1503. Многочлен

how you compare doubles?
Послано Baurzhan 1 фев 2011 09:51
Persons, who got AC without long arithmetics,tell me how did you comapre doubles? I used construction: fabs(r-l)>eps,where eps=1e-15, and i'm getting wa5 every time. Please,somebody, help me to find the bug, I need it in my work to solve polinomial of 5-th degree.My code available for looking - my judge id - 77493FG, password - shared, last submissions - 1503 problem. If somebody will find bug in my code,please write it on this thread.

Edited by author 01.02.2011 09:52
Re: how you compare doubles?
Послано Baurzhan 6 фев 2011 09:52
up
Re: how you compare doubles?
Послано Baurzhan 8 фев 2011 11:11
up, blyat,up!
Re: how you compare doubles?
Послано hoan 10 фев 2011 17:59
I dont use binary-search with double all in my life but i think you can use long long instead of double, and for every expresion you devide the parameter by 10^7.

like this:
double a= 1.1234567;
cout << a * 1e-1 << endl; ---> 0.11234567

you can use:
long long a= 11234567;
cout << ((long double)a * 1e-7) * 1e-1 ---> 0.11234567

I hope can help you

Edited by author 10.02.2011 17:59
Re: how you compare doubles?
Послано Baurzhan 10 фев 2011 20:20
thanks for advice, but it seems impossible for me to use long long because my aim is not submit 1503 problem, but care about cases when coefficients of polinomial is large enough - 10^20,10^30 - i need it in my work.Long long doesn't  allow to store such large numbers as I need. Also, I red in the forum that somobody accepted this problem with algorithm similar to mine, so my approach is correct but has some troubles with precision. Anyway, a lot of thanks for advice!