- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要从我的 Blackberry Java 应用程序计算反正切值。不幸的是,黑莓 4.2 api 没有 Math.atan() 函数。 Blackberry JDE 的 4.6 版有它,但 4.2 版没有。
有人知道计算 atan 的解决方法吗?
最佳答案
来自 Arctan in J2ME by Stephen Zimmerman :
// calculation functions
public class Calculation {
// Because J2ME has no floating point numbers,
// some sort of fixed point math is required.
// My implementation is simply to shift 10 places.
// for example, 1024 (>> 10) = 1
// and 512 (>> 10) = 0.5
public static final int[] AtanTable = { 0, 1, 2, 3, 5, 6, 7, 8, 10, 11, 12,
13, 14, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29,
30, 30,31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 40, 41,
42, 43, 43, 44, 45 };
// / returns angle 0->359 in degrees
public static int atan(int Y, int X) {
boolean swap = false;
int top = Math.abs(Y);
int bottom = Math.abs(X);
if (top > bottom) {
int btemp = bottom;
bottom = top;
top = btemp;
swap = true;
} else if (bottom == 0)
return -300;
// this should keep index inbounds [0, 45]
int index = (top * 45) / bottom;
int angle = AtanTable[index];
if (swap)
angle = 90 - angle;
// X & Y += 180
// X & !Y = ...90
// !X & Y = ... 270
if ((X < 0) && (Y < 0))
angle += 180;
else if (Y < 0) {
angle = 90 - angle;
angle += 270;
} else if (X < 0) {
angle = 90 - angle;
angle += 90;
}
if (angle == 360)
angle = 0;
return angle;
}
}
关于math - 在 Blackberry 4.2 JDE 上调用 atan 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1455292/
黑莓 JDE 不包括 java.util.ArrayList ,即使它知道 java.util ?那是怎么回事? BB 有对应的类(class)吗?我不想使用数组,真的,因为我要处理的对象数量未知。为
我想在 emacs 中开发 java。我安装了 ecb、jde 和自动完成扩展。每一个都运行良好,而无需启动其他。但是当我想一起使用它们时,发生了一些问题。 自动完成模式不会自动启动 jde,我需要通
我是 Blackberry 编程的新手,很快就会开始我的第一个应用程序。我相信我将支持 OS 4.5 及更高版本,但现在需要决定使用哪个 JDE。我想支持尽可能多的手机,这就是为什么我认为 4.5 及
我正在为 OS 6.0 使用来自黑莓(不是 eclipse)的标准黑莓编辑器。它附带的模拟器适用于型号 9800 Torch,但我想将它用于 Bold 9650。我已经从网上下载了 Bold 9650
我对如何在 Blackberry JDE 中实现 FieldChangeListener 感到有点困惑。一种方法是让我的主类实现 FieldChangeListener,然后在其中添加一个 field
我正在使用 Eclipse 的 JDE 插件(版本 1.0.0.67)开发 BlackBerry 应用程序,我想知道是否有一个可以运行这些应用程序的设备列表。 这是出于商业目的,我们需要能够告诉客户支
我正在尝试在 Windows 7 上安装 Blackberry JDE。我安装了 java,并将 JAVA_HOME 变量设置为 java 的安装目录,但是安装程序告诉我找不到 Java,我需要下载并
所以,我正在使用 HTTPConnection 类,如下所示: HttpConnection c = (HttpConnection)Connector.open("http://147.11
我在安装 BlackBerry JDE 插件时遇到问题。我已从 BlackBerry 网站下载并安装了该插件。安装顺利完成。但是,当我打开 Eclipse 时,没有显示 BlackBerry 选项。
我正在编写代码以从公历日期转换为 JDE ( J.D.Edwards ) 儒略日期。 注意:JDE 儒略日期与术语 Julian date 的正常用法不同。 . 据我通过 Google 搜索得出,JD
所以,我正在尝试从 HTTP url 获取要播放的视频。为此,我使用 URL 对象,然后对其进行 openStream,如下所示: URL url = new URL("http://good
我遵循了本指南: http://www.thinkingblackberry.com/archives/21/comment-page-1#comment-104 安装了 JDE 4.7 和 4.5
我们正在尝试为 JDE9.0 使用动态 java 连接器,但面临着进程句柄数量增加的问题。 场景: 并行调用动态 JDE 连接器并同时进行多个调用。 执行BSFN的实现流程如下: 1)登录方法具有所有
当我在 eclipse 中输入以下 Java 代码时,它返回一个错误。 Eclipse 教程告诉我这应该可行。我究竟做错了什么? This is a picture of my code 。 impo
我知道可以使用 SELECT 语句(在 JDEdwards 中,我们有一个业务函数 [C 语言],可以对 SELECT 语句执行此操作),但是我需要制作一个可以进行“动态上传”的新功能。 在这种情况下
我在不使用 Blackberry JDE 或 Eclipse 插件的情况下构建我的应用程序 .cod 文件。如果我硬编码我的 main() 方法需要的字符串参数,那么在模拟器中一切正常。 (我正在使用
我认为我在 Blackberry 9000 模拟器上错误地使用了 InputStream: 我找到了一些示例代码, http://www.blackberry.com/knowledgecenterp
我正在尝试使用 float f[] = new float[20] ; java.util.Arrays.fill( f, 0.0f ) ; 但是 Eclipse 将第二行标记为 java.util.
在我的系统中,时间戳使用旧的 IBM julian 格式返回。 例如: 12 点 0 分 1 秒 AM(午夜后 1 秒)返回 01。 12 点 22 分 15 秒 AM 返回 2215。 1点22分1
main[1] 打印变量 com.sun.tools.example.debug.expr.ParseException:名称未知:myVariable 我的变量 = null 关于为什么会发生这种情
我是一名优秀的程序员,十分优秀!