57 lines
1.4 KiB
Text
57 lines
1.4 KiB
Text
[ $ \
|
|
try:
|
|
float(string_from_stack())
|
|
except:
|
|
to_stack(False)
|
|
else:
|
|
to_stack(True)
|
|
\ python ] is isfloat ( $ --> b )
|
|
|
|
[ nextword
|
|
dup isfloat not if
|
|
[ $ '"f" needs to be followed by a number.'
|
|
message put bail ]
|
|
' [ ' ] swap nested join
|
|
nested swap dip join ] builds f ( [ $ --> [ $ )
|
|
|
|
[ $ \
|
|
import math
|
|
a = string_from_stack()
|
|
a = str(math.sin(float(a)))
|
|
string_to_stack(a) \ python ] is sin ( $ --> $ )
|
|
|
|
[ $ \
|
|
import math
|
|
a = string_from_stack()
|
|
a = str(math.asin(float(a)))
|
|
string_to_stack(a) \ python ] is asin ( $ --> $ )
|
|
|
|
[ $ \
|
|
import math
|
|
a = string_from_stack()
|
|
a = str(math.cos(float(a)))
|
|
string_to_stack(a) \ python ] is cos ( $ --> $ )
|
|
|
|
[ $ \
|
|
import math
|
|
a = string_from_stack()
|
|
a = str(math.acos(float(a)))
|
|
string_to_stack(a) \ python ] is acos ( $ --> $ )
|
|
|
|
[ $ \
|
|
a = string_from_stack()
|
|
b = string_from_stack()
|
|
c = str(float(b) * float(a))
|
|
string_to_stack(c) \ python ] is f* ( $ $ --> $ )
|
|
|
|
[ $ \
|
|
a = string_from_stack()
|
|
b = string_from_stack()
|
|
c = str(float(b) / float(a))
|
|
string_to_stack(c) \ python ] is f/ ( $ $ --> $ )
|
|
|
|
[ $ \
|
|
a = string_from_stack()
|
|
b = string_from_stack()
|
|
c = str(float(b) ** float(a))
|
|
string_to_stack(c) \ python ] is f** ( $ $ --> $ )
|