The behaviour of System.Math.Truncate when generated to JavaScript is not
consistent with .net.
public static void TestTruncate()
{
new jQuery(HtmlContext.document.body).append("1.4 truncated: " + System.Math.Truncate(1.4) + "<br/>");
new jQuery(HtmlContext.document.body).append("1.6 truncated: " + System.Math.Truncate(1.6) + "<br/>");
new jQuery(HtmlContext.document.body).append("-1.4 truncated: " + System.Math.Truncate(-1.4) + "<br/>");
new jQuery(HtmlContext.document.body).append("-1.6 truncated: " + System.Math.Truncate(-1.6) + "<br/>");
new jQuery(HtmlContext.document.body).append("Type of 1.2 truncated: " + System.Math.Truncate(1.2).GetType() + "<br/>");
}
This results in:
1.4 truncated: 1
1.6 truncated: 2
-1.4 truncated: -1
-1.6 truncated: -2
Type of 1.2 truncated: {Name = String FullName = System.String}
There are two issues. First it's rounding rather than truncating. Secondly it's
turning the output in a string.
To confirm it's definitely a string, with the console:
typeof(System.Math.Truncate$$Double(1.2))
"string"
Original issue reported on code.google.com by co...@gravill.com on 5 Dec 2013 at 1:48
Original issue reported on code.google.com by
co...@gravill.com
on 5 Dec 2013 at 1:48