Float value changes after writing to realm even for integer part of the complete number

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintableJSON

      How frequently does the bug occur?

      Always

      Description

      Float value changes after writing to realm even for integer part of the complete number

      import Realm from "realm"
      
      class TData extends Realm.Object {
          static schema = {
              name: "CategoryModel",
              properties: {
                  b: "string",
                  a: "double",
                  c: "float",
              },
              primaryKey: 'b',
          }
      }
      
      const db = {
          //path: DB_PATH,
          schema: [TData]
      }
      
      let realm = await Realm.open(db);
      
      let p = `${Date.now()}`
      
      let v = 1628899821
      
      realm.write(() => {
          realm.create(TData, { a: v, c: v, b: p })
      })
      
      console.log(realm.objectForPrimaryKey(TData, p).toJSON())
      

      Stacktrace & log output

      No response

      Can you reproduce the bug?

      Always

      Reproduction Steps

      No response

      Version

      12.3.1

      What services are you using?

      Local Database only

      Are you using encryption?

      No

      Platform OS and version(s)

      Windows 11

      Build environment

      No response

      Cocoapods version

      No response

            Assignee:
            Unassigned
            Reporter:
            Unito Sync Bot
            Archiver:
            Marc Greenfield

              Created:
              Updated:
              Archived: