question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Printing VectorFloat3 of size <4 throws IllegalFormatConversionException

See original GitHub issue

Describe the bug Printing VectorFloat3 of size <4 throws IllegalFormatConversionException

How To Reproduce Attempt to print a VectorFloat3 of size less than four, for example :

VectorFloat3 circleCenters = new VectorFloat3(2);

circleCenters.set(0, new Float3(0,0,10));
circleCenters.set(1, new Float3(1000,1000,2000));

System.out.println(circleCenters);

Expected behavior

Output: <[0, 0, 10], [1000, 1000, 2000]>

Computing system setup (please complete the following information):

  • OS: Arch Linux
  • OpenCL Version 1.2
  • TornadoVM commit id 29b4554

Additional context

This is caused by the following code in uk.ac.manchester.tornado.api.collections.types.VectorFloat3:

public String toString() {
        return this.numElements > 3 ? String.format("VectorFloat3 <%d>", this.numElements) : this.toString("{%.3f,%.3f,%.3f}");
    }

Which fails as the elements are of type Float3 and not float. Instead, it should be:

public String toString() {
        if (this.numElements > 3)
            return String.format("VectorFloat3 <%d>", this.numElements);
        String tempString = "";
        for (int i = 0; i<numElements; i++){
            tempString += (" " + this.get(i).toString)
        }
        return tempString
    }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jjfumerocommented, Feb 8, 2021

@mikepapadim , coordinate with @stratika . He is solving this issue as well.

1reaction
mikepapadimcommented, Feb 8, 2021

I am looking into this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Resolve the Illegal Format Conversion Exception in Java
Java's IllegalFormatConversionException is an unchecked exception thrown when an incompatible type argument is passed to a format specifier.
Read more >
java.util.IllegalFormatConversionException - Stack Overflow
%d goes with integer in Java. Use %f instead in your printf(). Another useful info. If you use %.02f then it will print...
Read more >
TornadoVM 0.9 · GitHub
TornadoVM: A practical and efficient heterogeneous programming framework for managed languages - TornadoVM 0.9 · beehive-lab/TornadoVM.
Read more >
IllegalFormatConversionException (Java Platform SE 8 )
Unchecked exception thrown when the argument corresponding to the format specifier is of an incompatible type. Unless otherwise specified, passing a null ...
Read more >
[Solved] java.util.IllegalFormatConversionException
IllegalFormatConversionException is an Unchecked. ... Below line will throw IllegalFormatConversionException as we are trying to print "y" double data type ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found