[SERVER-37731] Why $pow results in NaN when every other operation illegal math operation causes error? Created: 24/Oct/18  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: Raghuram Krishnaswami Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: mql-semantics
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Optimization
Participants:

 Description   

As given here,

{ $pow: [ -50.5 ] } 



 Comments   
Comment by Ramon Fernandez Marina [ 26/Oct/18 ]

Thanks for your report krish.raghuram. We've sent this to the Query team for evaluation. If it gets folded into SERVER-27190 please watch that ticket for further updates.

Regards,
Ramón.

Comment by Raghuram Krishnaswami [ 24/Oct/18 ]

Umm... I clicked "create" before completing the description. And Im not able to edit the issue description either...

So I'll just leave the description here...

--------------------------------------------------------------------------------------------------------------

As given here

{ $pow: [ -5, 0.5 ] } 

results in a NaN value.

Every other illegal math operation, such as

  • $log10 of negative number
  • $ln of negative number
  • $log of negative number OR negative base
  • $sqrt of negative number

result in an error.

Wouldn't it be more consistent to make the $pow also an error?

PS : The issue was already mentioned before, in SERVER-27190. But it was brought up as a use-case, and was not the main point of focus.

Generated at Thu Feb 08 04:46:50 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.