redhat-developer / yaml-language-server

Language Server for YAML Files
MIT License
1.1k stars 264 forks source link

multipleOf does not work for floats #985

Open Willem-J-an opened 3 months ago

Willem-J-an commented 3 months ago

Describe the bug

This code does not seem to accurately calculate if a number is a multipleOf in the case of float numbers. A value of 0.9 with a multipleOf is flagged, because 0.9 % 0.05 === 0.05 in javascript.

Expected Behavior

Value of 0.9 is not flagged.

Current Behavior

Value of 0.9 is flagged.

Steps to Reproduce

  1. Create schema with multipleOf 0.05
  2. Set value of 0.9
  3. The value is flagged as not being a multiple of 0.05

Environment