simon.wade_ Posted April 26, 2012 Posted April 26, 2012 There appear to be a few issues with UnigineScript parsing float and double literal values. Here's an example you can try: void testLiterals() { float f; // Let's try and use this value f = 4.3E-7f; log.message("4.3E-7f is %g\n", f); // So maybe scientific notation is the issue... f = 0.00000043f; log.message("0.00000043f is %g\n", f); // How about doubles? f = 4.3E-7; log.message("4.3E-7 is %g\n", f); // And again with the notation f = 0.00000043; log.message("0.00000043 is %g\n", f); // Maybe it's a printing issue? log.message("4.3 is %g\n", f * 10000000); // *sobs* } Results in the following: 4.3E-7f is 1e-006 0.00000043f is 1e-006 4.3E-7 is 0 0.00000043 is 0 4.3 is 0 Obviously this is not so great. Sadly, I'm not sure which SDK version I'm running (will hopefully find out tomorrow), but the log file tells me I'm running version 2.47 of the Interpreter (if that helps). Let me know if you'd like any additional information and I'll hunt it down for you :D 1
frustum Posted April 26, 2012 Posted April 26, 2012 The result from interpreter 2.48 is: :!./test.usc 4.3E-7f is 4.3e-07 0.00000043f is 4.3e-07 4.3E-7 is 4.3e-07 0.00000043 is 4.3e-07 4.3 is 4.3 There were no changes regarding literals parsing recently.
simon.wade_ Posted April 30, 2012 Author Posted April 30, 2012 Interesting... I just tried it from the command line with interpreter 2.48 and it worked fine. However, if I tried running the same thing from within the editor - by jamming the code in to the init() function in the scratch project - I get: 4.3E-7f is 0 0.00000043f is 0 4.3E-7 is 4.3e-007 0.00000043 is 4.3e-007 4.3 is 4.3 So at least the doubles are working, but the floats are still wacky :( 1
sergey.shandar Posted May 8, 2012 Posted May 8, 2012 I've experienced the same problem. Can anyone else confirm it? 1
manguste Posted May 8, 2012 Posted May 8, 2012 Please, provide us with a test scene for reproduction, it would be most helpful for solving this issue.
frustum Posted July 31, 2012 Posted July 31, 2012 It was a really strange interpreter issue... Interpreter used a default variable compare operator to remove constant duplicates. And from this operator's point of view 1.0e-6f is equal to 4.7e-7f... The problem is fixed. 1
Recommended Posts