Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-2656

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

      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 Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: