Resistor mesh: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: oops, actually display revised output) |
m (→{{header|REXX}}: changed two comments.) |
||
Line 1,839: | Line 1,839: | ||
Dropping the decimal digits precision ('''numeric digits''') to '''10''' makes the execution '''3''' times faster. |
Dropping the decimal digits precision ('''numeric digits''') to '''10''' makes the execution '''3''' times faster. |
||
<lang rexx>/*REXX program calculates the resistance between any two points on a |
<lang rexx>/*REXX program calculates the resistance between any two points on a resistor grid.*/ |
||
if 2=='f2'x then ohms = "ohms" /*EBCDIC machine? Then use 'ohms'. */ |
if 2=='f2'x then ohms = "ohms" /*EBCDIC machine? Then use 'ohms'. */ |
||
else ohms = "Ω" /* ASCII " " " Greek Ω.*/ |
else ohms = "Ω" /* ASCII " " " Greek Ω.*/ |
||
Line 1,851: | Line 1,851: | ||
if digs=='' | digs=="," then digs= 20 /* " " " " " " */ |
if digs=='' | digs=="," then digs= 20 /* " " " " " " */ |
||
numeric digits digs /*use moderate decimal digs (precision)*/ |
numeric digits digs /*use moderate decimal digs (precision)*/ |
||
minVal = 1'e-' || (digs*2) /*calculate the threshold |
minVal = 1'e-' || (digs*2) /*calculate the threshold minimal value*/ |
||
say ' minimum value is ' format(minVal,,,,0) " using " digs ' decimal digits'; say |
say ' minimum value is ' format(minVal,,,,0) " using " digs ' decimal digits'; say |
||
say ' resistor mesh size is: ' wide "wide, " high 'high' ; say |
say ' resistor mesh size is: ' wide "wide, " high 'high' ; say |