###############################################################################
#
# This file contains expressions used for testing the evaluation of
# expressions. It is intended to cover all the built-in functions with all
# possible parameter types.
#
###############################################################################
#####################################################################
# Plus
1+1
2
1+1+1+1+1+1+1+1
8
1+(1+(1+(1)))
4
(1+1)+1
3
1+i
i+1
i+i
2*i
#####################################################################
# Minus
1-1
0
1-1-1
-1
1-(1-1)
1
0-3
-3
1-i
-i+1
i-1
-1+i
#####################################################################
# Multiplication
0*1
0
1*2
2
2*1
2
#####################################################################
# Division
4/2
2
1/2-0.5
0
0/2
0
#####################################################################
# Modulus
1 % 2
1
0 % 3
0
3 % 2
1
3 % 2.5
0.5
5 % -2
1
-5 % 2
-1
#####################################################################
# Power
1^2
1
2^2
4
1^0
1
2^0
1
1^-1
1
2^-1
0.5
(-3)^2
9
-3^2
-9
i^2
-1
1^i
1
#####################################################################
# 'Correct' precedence of unary - and ^
-1^2
-1
(-1)^2
1
#####################################################################
# Pi
sin(pi)
0
pi*sin(0)
0
cos(pi)
-1
cos(pi/2)
0
#####################################################################
# Sine
sin(0)
0
sin(pi/2)
1
sin(pi)
0
sin(3*pi/2)
-1
sin(pi/6)
0.5
sin(pi/3)
sqrt(3)/2
#####################################################################
# Cosine
cos(0)
1
cos(pi/2)
0
cos(pi)
-1
cos(3*pi/2)
0
cos(pi/6)
sqrt(3)/2
cos(pi/3)
0.5
#####################################################################
# Tangent
tan(0)
0
tan(pi)
0
tan(pi/4)
1
#####################################################################
# Inverse Sine
asin(0)
0
asin(1)
pi/2
asin(-1)
-pi/2
#####################################################################
# Inverse Cosine
acos(0)
pi/2
acos(1)
0
acos(-1)
pi
#####################################################################
# Inverse Tangent
atan(0)
0
atan(1)
pi/4
atan(-1)
-pi/4
atan2(0, 0)
0
atan2(1, 0)
pi/2
atan2(0, 1)
0
atan2(-1, 0)
-pi/2
atan2(0, -1)
pi
#####################################################################
# Hyperbolic functions
sinh(0)
0
cosh(0)
1
tanh(0)
0
asinh(0)
0
acosh(1)
0
acosh(cosh(i))
i
atanh(0)
0
atanh(tanh(i))
i
#####################################################################
# Natural Logarithm
ln(1)
0
ln(e)
1
ln(e^32)
32
#####################################################################
# Log base 10
log(1)
0
log(10)
1
log(100)
2
#####################################################################
# Log base 2
lg(1)
0
lg(4)
2
lg(1024)
10
lg(.5)
-1
lg(.25)
-2
abs(lg(i) - 2.26618007 i) < 0.00000001
true
#####################################################################
# Complex algebra
i^2
-1
i*i
-1
i-i
0
i+i
2*i
(i+2)/2
(i/2+1)
i/i
1
(1+3*i)*2
(2+6*i)
(1+1*i)*(2+2*i)
(0+4*i)
#####################################################################
# Roots of negative numbers
(-1)^(1/2)
i
sqrt(-1)
i
(-4)^(1/2)
2*i
#(-8)^(1/3)
#-2
#(-27)^(1/3)
#-3
#####################################################################
# Not operator
!1
false
!0
true
!true
false
!false
true
#####################################################################
# equals operator
1==1
true
1==0
false
i == i
true
i == 0
false
0 == i
false
true == true
true
false == false
true
true == false
false
false == true
false
#####################################################################
# not equals
1!=1
false
1!=0
true
i != 1
true
1 != i
true
i != i
false
true != true
false
false != false
false
true != false
true
false != true
true
#####################################################################
# comparative
1<0
false
1<2
true
1>0
true
1>2
false
1>=1
true
1>=1.1
false
1<=1
true
1<=0.9
false
#####################################################################
# And
1 && 1
true
1 && 0
false
0 && 1
false
0 && 0
false
true && true
true
true && false
false
false && true
false
false && false
false
#####################################################################
# Or
1 || 0
true
1 || 1
true
0 || 1
true
0 || 0
false
true || false
true
true || true
true
false || true
true
false || false
false
#####################################################################
# String functions
# (need to use == operator in one line and compare
# to value because JEPTester does not handle String
# results)
"ab" == "ab"
true
"a" == "b"
false
"ab" + "c" == "abc"
true
"a" + "b" + "c" + "d" == "abcd"
true
"abcd" + "efg" == "abcdefg"
true
"abcd" + "efg" == "abcd"
false
"abcd" + "efg" == "efg"
false
"A" == "a"
false
"a" + "b" == "ab"
true
"a" != "b"
true
"ab" + "cd" != "abcd"
false
#####################################################################
# exp function
exp(0)
1
exp(1)
e
exp(2)
e^2
exp(-1.5)
e^(-1.5)
exp(pi*i)
-1
#####################################################################
# abs function
abs(-1)
1
abs(1)
1
abs(0)
0
abs(i)
1
abs(2*i)
2
abs(i+1)
sqrt(2)
#####################################################################
# rand function
rand() < 1
true
rand() > 0
true
#####################################################################
# modulus function
mod(11,10)
1
mod(1,2)
1
mod(1,5)
1
#####################################################################
# sqrt function
sqrt(1)
1
sqrt(0)
0
sqrt(-1)
i
sqrt(25)
5
#####################################################################
# Sum
sum(1,2)
3
# The following expression does not evaluate correctly in JEP 2.20 and 2.21
1+sum(1)
2
sum(1)
1
sum(1, 2)
3
# The following expression causes an error in JEP 2.3.0 and is a known bug
sum(1, 2, 3, 4)
10
sum(1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
10
sum(i)
i
sum(i, i)
2*i
sum(1, i)
1+i
sum(i, 1)
1+i
sum("a", "b") == "ab"
true
#####################################################################
# if function
if(1, 0, 1)
0
if(.001, 0, 1)
0
if(0, 0, 1)
1
if(-0.001, 0, 1)
1
if(-2, 0, 1)
1
if(1, 1, 2, 3)
1
if(-1, 1, 2, 3)
2
if(0, 1, 2, 3)
3
if(true, 1, 0)
1
if(false, 1, 0)
0
#####################################################################
# str function
str(1) == "1.0"
true
str("1") == "1"
true
#####################################################################
# floor function
floor(1)
1
floor(1.1)
1
floor(1.9)
1
#####################################################################
# ceil function
ceil(1)
1
ceil(1.0000001)
2
ceil(1.9)
2
#####################################################################
# round function
round(1)
1
round(1.1)
1
round(1.9)
2
round(1.9, 2)
1.9
round(1.9, 1)
1.9
round(1.9, 0)
2
round(-1.2)
-1
round(-1.9)
-2
round(-1.25, 1)
-1.2
round(-1.9, 1)
-1.9
#####################################################################
# binom - Binomial function
binom(1,1)
1
binom(2,1)
2
binom(2,2)
1
binom(3,2)
3
binom(100,1)
100
##################################################
没有合适的资源?快使用搜索试试~ 我知道了~
jep-3.1.0-trial.zip
共644个文件
html:311个
class:256个
java:50个
需积分: 15 14 下载量 147 浏览量
2008-12-22
10:55:42
上传
评论
收藏 1.52MB ZIP 举报
温馨提示
对一个数学表达式进行计算,特别好用,可以嵌入到自己的项目中
资源推荐
资源详情
资源评论
收起资源包目录
jep-3.1.0-trial.zip (644个子文件)
run-class.bat 720B
BigDecimalConsole.bat 77B
VectorConsole.bat 73B
PrintConsole.bat 72B
ConfParserConsole.bat 69B
Console.bat 67B
JccParser.class 25KB
JepTest.class 20KB
JccParserTokenManager.class 11KB
TokenizerTest.class 10KB
PrintVisitor.class 7KB
ConfigurableParser.class 7KB
Console.class 6KB
ShuntingYard.class 6KB
Jep.class 6KB
JavaCharStream.class 6KB
Complex.class 6KB
NodeFactory.class 5KB
TokSpeed.class 5KB
Operator.class 5KB
SerializationTest.class 5KB
OperatorTable.class 5KB
BigDecimalTest.class 5KB
Evaluator.class 5KB
JEP.class 5KB
SerializableExpression.class 5KB
Evaluator.class 5KB
ExamineSizes.class 4KB
ExpressionEvalTest.class 4KB
RealEvaluator.class 4KB
StandardEvaluator.class 4KB
ExpressionEvalTest.class 4KB
Comparative.class 3KB
VectorConsole.class 3KB
BugsTest.class 3KB
VariableTable.class 3KB
DoNothingVisitor.class 3KB
FractalCanvas.class 3KB
Tokenizer.class 3KB
StandardFunctionTable.class 3KB
BugsTest.class 3KB
TreeAnalyzer.class 3KB
GraphCanvas.class 3KB
GraphCanvas.class 3KB
BigDecOperatorTable.class 3KB
Fractal.class 3KB
Fractal.class 3KB
SubstitutionVisitor.class 3KB
OperatorTokenMatcher.class 3KB
ComponentSet.class 3KB
FunctionTable.class 3KB
MacroFunction.class 3KB
FunctionGrammarMatcher.class 3KB
FractalCanvas.class 3KB
BigDecNumberFactory.class 3KB
SimpleNode.class 3KB
SerializableExpression$Constant.class 3KB
PostfixEvaluator.class 3KB
ListOrBracketGrammarMatcher.class 3KB
ListGrammarMatcher.class 3KB
ParseException.class 2KB
PostfixTreeWalker.class 2KB
ArrayAccessGrammarMatcher.class 2KB
LightWeightComponentSet.class 2KB
Subtract.class 2KB
ThreadTest.class 2KB
Power.class 2KB
StandardOperatorTable.class 2KB
Add.class 2KB
BigDecRelationalTest.class 2KB
OperatorToken.class 2KB
Multiply.class 2KB
StandardParser.class 2KB
JccParserConstants.class 2KB
Divide.class 2KB
ThreadTest$EvaluationThread.class 2KB
JEPTest.class 2KB
PrefixTreeWalker.class 2KB
CPTest.class 2KB
SerializableExpression$Function.class 2KB
Ele.class 2KB
SerializableExpression$Operator.class 2KB
BigDecimalConsole.class 2KB
Average.class 2KB
TokenMgrError.class 2KB
Binomial.class 2KB
FunctionPlotter.class 2KB
DeepCopyVisitor.class 2KB
ParseSpeed.class 2KB
Cross.class 2KB
JJTJccParserState.class 2KB
FunctionPlotter.class 2KB
StringTokenMatcher.class 2KB
EleTest.class 2KB
Console.class 2KB
Assign.class 2KB
DoubleNumberFactory.class 2KB
LazyLogical.class 2KB
CommentTokenMatcher.class 2KB
BigDecComponents.class 2KB
共 644 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
OracleJ
- 粉丝: 24
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- xyctf:从入门到精通的实用指南.zip
- mmqrcode1714153659780.png
- Screenshot_2024-04-27-06-08-58-486_com.baidu.xin.aiqicha.jpg
- 基于Javaweb+Tomcat+MySQL的大学生公寓管理系统+sql文件.zip
- 实训作业基于javaweb的订单管理系统源码+数据库+实训报告.zip
- 多机调度问题贪心算法基于最小堆和贪心算法求解多机调度问题.zip
- 基于同态加密技术的匿名电子投票系统源码.zip
- Pyqt5项目框架-PyQt项目开发实践
- 基于C通过MQTT的智能农业大棚管理系统(本科毕业设计)
- python+CNN的网络入侵检测算法源码.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功