Harry and Probability

4.7

3 votes
Easy-Medium
Problem

Harry is doing magic practice on X axis.He found 4 points A,B,C,D. Now consider line AB and CD ( |AB|=|CD| ) , he guesses an angle alpha and rotates line segment AB by angle alpha keeping B as center. He found that line segment CD also started rotating anti clock wise keeping center as C and by angle alpha. Now he wants to find probability of intersection of both line segments.

Input :
First line contains T- no. of test cases.
Next T line contains 4 space separated integers - A, B, C, D. which are x co ordinates of 4 points.

Output :
Print required probability with exact 6 decimal places.

Constraints :
1<=T<=105
0<=A,B,C,D <=1015
A < B < C < D

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?