[MONGOCRYPT-490] Support range float precision Created: 18/Oct/22  Updated: 28/Oct/23  Resolved: 22/Nov/22

Status: Closed
Project: Libmongocrypt
Component/s: None
Affects Version/s: None
Fix Version/s: 1.7.0, 1.7.0-alpha0

Type: Task Priority: Unknown
Reporter: Kevin Albertson Assignee: Kevin Albertson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-69668 FLE2 range float precision: update OS... Closed
Epic Link: libmongocrypt Support for Range Index
Server Compat: 6.2

 Description   

Summary



 Comments   
Comment by Githook User [ 22/Nov/22 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}

Message: MONGOCRYPT-490 support precision for `double` (#497)

  • add optional uint32 and uint64 types
  • port precision for mc_getTypeInfoDouble
  • link to libm
  • add min/max/precision to mincover edge and mincover algorithms
  • add precision to placeholders
  • pass precision to mincover in mc_get_mincover_from_FLE2RangeFindSpec
  • pass precision to mc_getEdgesDouble
  • update edgesInfo reference for optional

It was made optional in explicit encryption changes

  • support precision in range opts

also add explicit double tests without precision

  • refactor _test_encrypt_fle2_explicit

Use test case structs to shorten test code.

  • make min/max optional

Require min/max/precision to all be set or unset for double/decimal128
If min/max is missing default to the lowest/highest representable value

  • zero output in mc_FLE2RangeInsertSpec_parse
  • remove duplicated `bson_iter_init_find`s
  • fix comment for mc_RangeOpts_appendMax

Co-authored-by: Gil Alon <47804748+galon1@users.noreply.github.com>

  • fix precision assert
  • error if encoding double outside of min/max
  • use -DBL_MAX, not DBL_MIN

DBL_MIN is smallest postive DBL.

Change has no impact, but is consistent. The default applied in mc_RangeOpts_appendMin is not used in mc_getTypeInfoDouble.

  • error earlier if mincover is called with incorrect bounds

This results in error messages containing the original inputs before encoding.

  • test min > max for insert and find
  • fix format for CHECK_BOUNDS
  • fix expected error message
  • add test with open interval

Co-authored-by: Gil Alon <47804748+galon1@users.noreply.github.com>
Branch: master
https://github.com/mongodb/libmongocrypt/commit/d55e2f82f7c4e1f4f77cfde5e9526f270608db7b

Generated at Thu Feb 08 09:08:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.