#include<stdio.h>
#include<string.h>
#include<iostream>
#include<iomanip>
#include<math.h>
using namespace std;

int main()
{
    int n;
    double a, b, px, py;
    cin >> n;
    while(n--)
    {
        cin >> a >> b >> px >> py;
        if (py < 0)
            py = -py;
        else if (py == 0)
        {
            cout << setprecision(2) << 0.00 << endl;
            continue;
        }
        double jx, jy, k;
        k = py * 1.0 / px;
        jx = (a * a * b * b) / (b * b + a * a * k * k);
        jx = sqrt(jx);
        jy = k * jx;
        double angle = atan(py * 1.0 / px);
        double s1 = (0.5 * a * b * angle) - (0.25 * a * b * sin(2 * angle));
        double s2 = 0.5 * jx * jy;
        double s = s1 + s2;
        cout << setprecision(2) << s << endl;
    }
    return 0;
}

posted on 2015-07-22 17:42  小小八  阅读(114)  评论(0编辑  收藏  举报