Add math functions to cpp layer (#1069)

This commit is contained in:
Guillaume Jenkins 2018-08-09 15:54:51 -04:00 committed by GitHub
parent ae0a684d2e
commit eebaf91f6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 2 deletions

View File

@ -380,7 +380,7 @@
"music.changeTempoBy": "Change the tempo by the specified amount",
"music.changeTempoBy|param|bpm": "The change in beats per minute to the tempo, eg: 20",
"music.noteFrequency": "Gets the frequency of a note.",
"music.noteFrequency|param|name": "the note name, eg: Note.C",
"music.noteFrequency|param|name": "the note name",
"music.onEvent": "Registers code to run on various melody events",
"music.playTone": "Plays a tone through pin ``P0`` for the given duration.",
"music.playTone|param|frequency": "pitch of the tone to play in Hertz (Hz), eg: Note.C",

View File

@ -302,7 +302,7 @@
"music.beginMelody|block": "start melody %melody=device_builtin_melody| repeating %options",
"music.builtInMelody|block": "%melody",
"music.changeTempoBy|block": "change tempo by (bpm)|%value",
"music.noteFrequency|block": "%note",
"music.noteFrequency|block": "%name",
"music.onEvent|block": "music on %value",
"music.playTone|block": "play|tone %note=device_note|for %duration=device_beat",
"music.rest|block": "rest(ms)|%duration=device_beat",

View File

@ -740,6 +740,48 @@ TNumber log(TNumber x){SINGLE(log)}
//%
TNumber log10(TNumber x){SINGLE(log10)}
//%
TNumber log2(TNumber x){SINGLE(log2)}
//%
TNumber exp(TNumber x){SINGLE(exp)}
//%
TNumber tan(TNumber x){SINGLE(tan)}
//%
TNumber tanh(TNumber x){SINGLE(tanh)}
//%
TNumber sin(TNumber x){SINGLE(sin)}
//%
TNumber sinh(TNumber x){SINGLE(sinh)}
//%
TNumber cos(TNumber x){SINGLE(cos)}
//%
TNumber cosh(TNumber x){SINGLE(cosh)}
//%
TNumber atan(TNumber x){SINGLE(atan)}
//%
TNumber atanh(TNumber x){SINGLE(atanh)}
//%
TNumber asin(TNumber x){SINGLE(asin)}
//%
TNumber asinh(TNumber x){SINGLE(asinh)}
//%
TNumber acos(TNumber x){SINGLE(acos)}
//%
TNumber acosh(TNumber x){SINGLE(acosh)}
//%
TNumber sqrt(TNumber x){SINGLE(sqrt)}