Uploaded image for project: 'Realm Kotlin'
  1. Realm Kotlin
  2. RKOTLIN-970

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

      How frequently does the bug occur?

      Always

      Description

      The following issue was raised for realm javascript (https://github.com/realm/realm-js/issues/6293) but it was also happening for realm-kotlin as we faced the same issue.

      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?

      – select –

      Reproduction Steps

      No response

      Version

      1.12.0

      What Atlas App Services are you using?

      Local Database only

      Are you using encryption?

      No

      Platform OS and version(s)

      Android

      Build environment

      Android Studio version: ...
      Android Build Tools version: ...
      Gradle version: ...

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: