Open dplassgit opened 9 months ago
MIght be able to use roundsd xmm1, xmm2, 0
to round a value in xmm1 to the nearest integer and place into xmm2. Then subtract xmm1=xmm1-xmm2
, take abs value (which isn't straightforward) and if it's < 1e-9
, that means it's a round number. THEN you can tack on .0
abs value might be as easy as pand
to turn off the sign bit
Refactor https://github.com/dplassgit/d2lang/commit/d5ea700543e3c44864c7b9ec4a461a49720f45b1#r132035269 so that it's all in one place too.
Maybe write code in C or d and link it in? First dlib?
This might not be feasible due to the very complex way Java decides when to print a trailing .0:
https://stackoverflow.com/questions/57778637/why-do-c-and-java-round-floats-differently
Sample code:
println 3.0
when run without optimization, prints
3
instead of3.0
.