-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
According to the documentation for ATN2
the first argument is numeric_expr_y
and the second argument is numeric_expr_x
and should equate to arctangent of y/x.
After testing I found out that cosmosdb-server has the arguments reversed.
Example from documentation:
SELECT VALUE {
arctangentInRadians: ATN2(35.175643, 129.44)
}
[
{
"arctangentInRadians": 0.265344532064832
}
]
A test I wrote to verify the behavior:
describe('ATN2', () => {
it('should support ATN2()', async () => {
const y = 35.175643;
const x = 129.44;
const v = Math.atan2(y, x);
const query = `SELECT ATN2(${y}, ${x}) as atn2`;
const { resources } = await container.items.query(query).fetchAll();
expect(resources[0].atn2).toBeCloseTo(v);
});
});
When I flip y and x it does work:
const query = `SELECT ATN2(${x}, ${y}) as atn2`; // Purposely flipped y/x
Metadata
Metadata
Assignees
Labels
No labels