User:Johan G/convert: Difference between revisions

Jump to navigation Jump to search
Throwing more meaningful error when converting to the same unit
m (Fix: Copied a bit too much from some previous expressions (including "round" by mistake))
(Throwing more meaningful error when converting to the same unit)
 
Line 4: Line 4:
     -->{{#switch: {{{2|}}}
     -->{{#switch: {{{2|}}}
     | mm = {{#switch: {{{3|}}}
     | mm = {{#switch: {{{3|}}}
      | mm = {{error|Conversion to same unit}}
       | in = {{User:Johan G/convert/rear|{{{1}}} div 25.4|in|{{{4|}}}|{{{5|}}}}}
       | in = {{User:Johan G/convert/rear|{{{1}}} div 25.4|in|{{{4|}}}|{{{5|}}}}}
       | ft = {{User:Johan G/convert/rear|{{{1}}} div 304.8|ft|{{{4|}}}|{{{5|}}}}}
       | ft = {{User:Johan G/convert/rear|{{{1}}} div 304.8|ft|{{{4|}}}|{{{5|}}}}}
Line 14: Line 15:
     | in = {{#switch: {{{3|}}}
     | in = {{#switch: {{{3|}}}
       | mm = {{error|Conversion not implemented}}
       | mm = {{error|Conversion not implemented}}
      | in = {{error|Conversion to same unit}}
       | ft = {{error|Conversion not implemented}}
       | ft = {{error|Conversion not implemented}}
       | m = {{error|Conversion not implemented}}
       | m = {{error|Conversion not implemented}}
Line 24: Line 26:
       | mm = {{error|Conversion not implemented}}
       | mm = {{error|Conversion not implemented}}
       | in = {{error|Conversion not implemented}}
       | in = {{error|Conversion not implemented}}
      | ft = {{error|Conversion to same unit}}
       | m = {{User:Johan G/convert/rear|{{{1}}} * 0.3048|m|{{{4|}}}|{{{5|}}}}}
       | m = {{User:Johan G/convert/rear|{{{1}}} * 0.3048|m|{{{4|}}}|{{{5|}}}}}
       | km = {{error|Conversion not implemented}}
       | km = {{error|Conversion not implemented}}
Line 34: Line 37:
       | in = {{User:Johan G/convert/rear|{{{1}}} div 0.0254|in|{{{4|}}}|{{{5|}}}}}
       | in = {{User:Johan G/convert/rear|{{{1}}} div 0.0254|in|{{{4|}}}|{{{5|}}}}}
       | ft = {{User:Johan G/convert/rear|{{{1}}} div 0.3048|ft|{{{4|}}}|{{{5|}}}}}
       | ft = {{User:Johan G/convert/rear|{{{1}}} div 0.3048|ft|{{{4|}}}|{{{5|}}}}}
      | m = {{error|Conversion to same unit}}
       | km = {{User:Johan G/convert/rear|{{{1}}} div 1000|km|{{{4|}}}|{{{5|}}}}}
       | km = {{User:Johan G/convert/rear|{{{1}}} div 1000|km|{{{4|}}}|{{{5|}}}}}
       | mi = {{User:Johan G/convert/rear|{{{1}}} div 1609.3|mi|{{{4|}}}|{{{5|}}}}}
       | mi = {{User:Johan G/convert/rear|{{{1}}} div 1609.3|mi|{{{4|}}}|{{{5|}}}}}
Line 44: Line 48:
       | ft = {{User:Johan G/convert/rear|{{{1}}} div 0.0003048|ft|{{{4|}}}|{{{5|}}}}}
       | ft = {{User:Johan G/convert/rear|{{{1}}} div 0.0003048|ft|{{{4|}}}|{{{5|}}}}}
       | m = {{User:Johan G/convert/rear|{{{1}}} div 1000|m|{{{4|}}}|{{{5|}}}}}
       | m = {{User:Johan G/convert/rear|{{{1}}} div 1000|m|{{{4|}}}|{{{5|}}}}}
      | km = {{error|Conversion to same unit}}
       | mi = {{User:Johan G/convert/rear|{{{1}}} div 1.6093|mi|{{{4|}}}|{{{5|}}}}}
       | mi = {{User:Johan G/convert/rear|{{{1}}} div 1.6093|mi|{{{4|}}}|{{{5|}}}}}
       | NM = {{User:Johan G/convert/rear|{{{1}}} div 1.852|NM|{{{4|}}}|{{{5|}}}}}
       | NM = {{User:Johan G/convert/rear|{{{1}}} div 1.852|NM|{{{4|}}}|{{{5|}}}}}
Line 54: Line 59:
       | m = {{error|Conversion not implemented}}
       | m = {{error|Conversion not implemented}}
       | km = {{User:Johan G/convert/rear|{{{1}}} * 1.60934|km|{{{4|}}}|{{{5|}}}}}
       | km = {{User:Johan G/convert/rear|{{{1}}} * 1.60934|km|{{{4|}}}|{{{5|}}}}}
      | mi = {{error|Conversion to same unit}}
       | NM = {{User:Johan G/convert/rear|{{{1}}} * 0.868976|NM|{{{4|}}}|{{{5|}}}}}
       | NM = {{User:Johan G/convert/rear|{{{1}}} * 0.868976|NM|{{{4|}}}|{{{5|}}}}}
       | #default = {{error|Parameter '''to-unit''' missing or not supported}}
       | #default = {{error|Parameter '''to-unit''' missing or not supported}}
Line 64: Line 70:
       | km = {{error|Conversion not implemented}}
       | km = {{error|Conversion not implemented}}
       | mi = {{error|Conversion not implemented}}
       | mi = {{error|Conversion not implemented}}
      | NM = {{error|Conversion to same unit}}
       | #default = {{error|Parameter '''to-unit''' missing or not supported}}
       | #default = {{error|Parameter '''to-unit''' missing or not supported}}
     }}
     }}
     | ft/s = {{#switch: {{{3|}}}
     | ft/s = {{#switch: {{{3|}}}
      | ft/s = {{error|Conversion to same unit}}
       | m/s = {{error|Conversion not implemented}}
       | m/s = {{error|Conversion not implemented}}
       | km/h = {{error|Conversion not implemented}}
       | km/h = {{error|Conversion not implemented}}
Line 75: Line 83:
     | m/s = {{#switch: {{{3|}}}
     | m/s = {{#switch: {{{3|}}}
       | ft/s = {{error|Conversion not implemented}}
       | ft/s = {{error|Conversion not implemented}}
      | m/s = {{error|Conversion to same unit}}
       | km/h = {{error|Conversion not implemented}}
       | km/h = {{error|Conversion not implemented}}
       | mph = {{error|Conversion not implemented}}
       | mph = {{error|Conversion not implemented}}
Line 83: Line 92:
       | ft/s = {{error|Conversion not implemented}}
       | ft/s = {{error|Conversion not implemented}}
       | m/s = {{error|Conversion not implemented}}
       | m/s = {{error|Conversion not implemented}}
      | km/h = {{error|Conversion to same unit}}
       | mph = {{error|Conversion not implemented}}
       | mph = {{error|Conversion not implemented}}
       | kt = {{error|Conversion not implemented}}
       | kt = {{error|Conversion not implemented}}
Line 91: Line 101:
       | m/s = {{error|Conversion not implemented}}
       | m/s = {{error|Conversion not implemented}}
       | km/h = {{User:Johan G/convert/rear|{{{1}}} * 1.60934|km/h|{{{4|}}}|{{{5|}}}}}
       | km/h = {{User:Johan G/convert/rear|{{{1}}} * 1.60934|km/h|{{{4|}}}|{{{5|}}}}}
      | mph = {{error|Conversion to same unit}}
       | kt = {{User:Johan G/convert/rear|{{{1}}} * 0.869|kt|{{{4|}}}|{{{5|}}}}}
       | kt = {{User:Johan G/convert/rear|{{{1}}} * 0.869|kt|{{{4|}}}|{{{5|}}}}}
       | #default = {{error|Parameter '''to-unit''' missing or not supported}}
       | #default = {{error|Parameter '''to-unit''' missing or not supported}}
Line 99: Line 110:
       | km/h = {{error|Conversion not implemented}}
       | km/h = {{error|Conversion not implemented}}
       | mph = {{User:Johan G/convert/rear|{{{1}}} * 1.152|mph|{{{4|}}}|{{{5|}}}}}
       | mph = {{User:Johan G/convert/rear|{{{1}}} * 1.152|mph|{{{4|}}}|{{{5|}}}}}
      | kt = {{error|Conversion to same unit}}
       | #default = {{error|Parameter '''to-unit''' missing or not supported}}
       | #default = {{error|Parameter '''to-unit''' missing or not supported}}
     }}
     }}
     | s = {{#switch: {{{3|}}}
     | s = {{#switch: {{{3|}}}
      | s = {{error|Conversion to same unit}}
       | min = {{User:Johan G/convert/rear|{{{1}}} div 60|min|{{{4|}}}|{{{5|}}}}}
       | min = {{User:Johan G/convert/rear|{{{1}}} div 60|min|{{{4|}}}|{{{5|}}}}}
       | h = {{User:Johan G/convert/rear|{{{1}}} div 3600|h|{{{4|}}}|{{{5|}}}}}
       | h = {{User:Johan G/convert/rear|{{{1}}} div 3600|h|{{{4|}}}|{{{5|}}}}}
Line 109: Line 122:
     | min = {{#switch: {{{3|}}}
     | min = {{#switch: {{{3|}}}
       | s = {{error|Conversion not implemented}}
       | s = {{error|Conversion not implemented}}
      | min = {{error|Conversion to same unit}}
       | h = {{error|Conversion not implemented}}
       | h = {{error|Conversion not implemented}}
       | d = {{error|Conversion not implemented}}
       | d = {{error|Conversion not implemented}}
Line 116: Line 130:
       | s = {{error|Conversion not implemented}}
       | s = {{error|Conversion not implemented}}
       | min = {{error|Conversion not implemented}}
       | min = {{error|Conversion not implemented}}
      | h = {{error|Conversion to same unit}}
       | d = {{error|Conversion not implemented}}
       | d = {{error|Conversion not implemented}}
       | #default = {{error|Parameter '''to-unit''' missing or not supported}}
       | #default = {{error|Parameter '''to-unit''' missing or not supported}}
Line 123: Line 138:
       | min = {{error|Conversion not implemented}}
       | min = {{error|Conversion not implemented}}
       | h = {{error|Conversion not implemented}}
       | h = {{error|Conversion not implemented}}
      | d = {{error|Conversion to same unit}}
       | #default = {{error|Parameter '''to-unit''' missing or not supported}}
       | #default = {{error|Parameter '''to-unit''' missing or not supported}}
     }}
     }}

Navigation menu