Skip to content

Commit 2520bf7

Browse files
committed
Add log10 function
1 parent 45d2cdf commit 2520bf7

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

GlowScriptOffline/glowscript_libraries/glow.3.2.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/VPythonDocs/math.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ <h1 class="Heading-1"> <font color="#0000A0">Math Functions</font></h1>
5151
sqrt(x)&nbsp;&nbsp;&nbsp;&nbsp;# square root<br />
5252
exp(x) &nbsp;&nbsp;&nbsp;&nbsp;# e to the x<br />
5353
log(x) &nbsp;&nbsp;&nbsp;&nbsp;# natural log, base e<br />
54-
# log(x)/log(10) gives log base 10<br />
54+
log10(x)&nbsp;&nbsp;&nbsp;# log base 10<br />
5555
pow(x,y) &nbsp;&nbsp;# x to the power y<br />
5656
pi &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# 3.14159.... <br />
5757
ceil(x)&nbsp;&nbsp;&nbsp;&nbsp;# round up to nearest integer<br />

lib/glow/vectors.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,11 @@
737737
return v.rotate({angle:angle, axis:axis})
738738
}
739739

740+
function log10(x) {
741+
const logten = Math.log(10)
742+
return log(x)/logten
743+
}
744+
740745
// Because RapydScript-NG compiles to the JavaScript string.replace function, which
741746
// replaces just one instance rather than multiple instances as in standard Python,
742747
// here we implement string.GSrep that acts like standard Python and we replace
@@ -757,6 +762,7 @@
757762
}
758763

759764
var exports = {
765+
log10: log10,
760766
mag: mag,
761767
mag2: mag2,
762768
norm: norm,

package/glow.3.2.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)