Printing VectorFloat3 of size <4 throws IllegalFormatConversionException
See original GitHub issueDescribe 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:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mikepapadim , coordinate with @stratika . He is solving this issue as well.
I am looking into this issue.