Skip to content

Issue with saving long values in a document #16

@DImuthuUpe

Description

@DImuthuUpe

When we try to save a long value into a map entry, it seems like it is saved as a float value. Following code prints "F64" as the type

import org.automerge.*;

import java.util.Optional;

public class IntFloatIssue {

    public static void main(String args[]) {
        Document doc = new Document();
        ObjectId annoMapObj;
        try (Transaction tx = doc.startTransaction()) {
            annoMapObj = tx.set(ObjectId.ROOT, "annotations", ObjectType.MAP);
            long value = 10000000000L;
            tx.set(annoMapObj, "longval", value);
            tx.commit();
        }

        Optional<AmValue> amValue = doc.get(annoMapObj, "longval");
        System.out.println(amValue.get().getClass().getSimpleName());
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions