Having said that: have you ever used one of these functoids in a map? Care to share
a real world example?
I’d be interested to find out how often they are used.
For each functoid I’ve shown:
Functoids covered in this category:
10^n | Natural Logarithm |
Arc Tangent | Sine |
Base-Specified Logarithm | Tangent |
Common Logarithm | X^Y |
Cosine | Common Code |
Natural Exponential Function |
Download the complete series as a single Microsoft
Word document (1.2MB) or Adobe
PDF document (620kb).
Scientific Functoids |
||
Note: XSLT has no intrinsic trigonometric functions, although you can download open source libraries such as FXSL |
||
|
|
|
Generates: C# |
Has XSLT Equivalent: No |
|
Emitted Code: public string SciExp10(string val) { string retval = “”; double dval = 0; if (IsNumeric(val, ref dval)) { double ret = Math.Pow(10.0, dval); retval = ret.ToString(System.Globalization.CultureInfo.InvariantCulture); } return retval; } |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
|
|
|
Generates: C# |
Has XSLT Equivalent: No |
|
Emitted Code: public string SciArcTan(string val) { string retval = “”; double dval = 0; if (IsNumeric(val, ref dval)) { double ret = Math.Atan(dval); retval = ret.ToString(System.Globalization.CultureInfo.InvariantCulture); } return retval; } |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
|
|
|
Generates: C# |
Has XSLT Equivalent: No |
|
Emitted Code: public string SciLogn(string val1, string val2) { string retval = “”; double dval1 = 0; double dval2 = 0; if (IsNumeric(val1, ref dval1) && IsNumeric(val2, ref dval2)) { if (dval1 > 0 && dval2 > 0) { double denom = Math.Log(dval2); if (denom != 0) { double ret = Math.Log(dval1) / denom; retval = ret.ToString(System.Globalization.CultureInfo.InvariantCulture); } } } return retval; } |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
|
|
|
Generates: C# |
Has XSLT Equivalent: No |
|
Emitted Code: public string SciLog10(string val) { string retval = “”; double dval = 0; if (IsNumeric(val, ref dval)) { if (dval > 0) { double ret = Math.Log10(dval); retval = ret.ToString(System.Globalization.CultureInfo.InvariantCulture); } } return retval; } |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
|
|
|
Generates: C# |
Has XSLT Equivalent: No |
|
Emitted Code: public string SciCos(string val) { string retval = “”; double dval = 0; if (IsNumeric(val, ref dval)) { double ret = Math.Cos(dval); retval = ret.ToString(System.Globalization.CultureInfo.InvariantCulture); } return retval; } |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
|
||
Generates: C# |
Has XSLT Equivalent: No |
|
Emitted Code: public string SciExp(string val) { string retval = “”; double dval = 0; if (IsNumeric(val, ref dval)) { double ret = Math.Exp(dval); retval = ret.ToString(System.Globalization.CultureInfo.InvariantCulture); } return retval; } |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
|
|
|
Generates: C# |
Has XSLT Equivalent: No |
|
Emitted Code: public string SciLog(string val) { string retval = “”; double dval = 0; if (IsNumeric(val, ref dval)) { if (dval > 0) { double ret = Math.Log(dval); retval = ret.ToString(System.Globalization.CultureInfo.InvariantCulture); } } return retval; } |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
|
|
|
Generates: C# |
Has XSLT Equivalent: No |
|
Emitted Code: public string SciSin(string val) { string retval = “”; double dval = 0; if (IsNumeric(val, ref dval)) { double ret = Math.Sin(dval); retval = ret.ToString(System.Globalization.CultureInfo.InvariantCulture); } return retval; } |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
|
|
|
Generates: C# |
Has XSLT Equivalent: No |
|
Emitted Code: public string SciTan(string val) { string retval = “”; double dval = 0; if (IsNumeric(val, ref dval)) { double ret = Math.Tan(dval); retval = ret.ToString(System.Globalization.CultureInfo.InvariantCulture); } return retval; } |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
|
|
|
Generates: C# |
Has XSLT Equivalent: No |
|
Emitted Code: public string SciPow(string val1, string val2) |
||
XSLT 1.0 Equivalent: (none) |
||
XSLT 2.0 Equivalent: (none) |
||
Common Code (this is common code used by all the scientific functoids) |
||
public bool IsNumeric(string val) { if (val == null) { return false; } double d = 0; return Double.TryParse(val, System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out d); } public bool IsNumeric(string val, ref double d) { if (val == null) { return false; } return Double.TryParse(val, System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out d); } |