首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >数学函数的溢出问题

数学函数的溢出问题
EN

Stack Overflow用户
提问于 2022-06-07 23:13:24
回答 1查看 60关注 0票数 -1

我创建了一个新的工作簿,并创建了一个新的模块"Module_Trigonometry“,并在那里实现了一个函数"KursWinkel”,我用德语命名变量、宏和函数,以避免与编译器本身的变量发生冲突,但是在这里,我遇到了一个非常奇怪的情况,在主菜单中的"VBA“中的"Developer-Tools”中的工作簿中,“KursWinkel”选项是greyen。如果我进入我的一张床单,例如。"Channel“in one Cell "= Kurs”Excel建议我的完整函数以圆括号打开,当我引用包含Sinus值的单元格并关闭支撑时,我的函数是"#Wert“(值)

代码语言:javascript
复制
Function KursWinkel(Sinus As Double) As Double
    'To get the angle for the value of the overgiven sinus-value we can only guess and this we do by
    'going throug the entire range of Double
    Dim s, r As Long
    For s = -4940656458412# To 494065645841247#
         If (Abs(Sinus) - Abs(s)) > r Then
           Exit For
        End If
        r = Abs(Sinus) - Abs(s)
    Next
    KursWinkel = r
End Function

这个函数有什么问题?

EN

回答 1

Stack Overflow用户

发布于 2022-06-09 07:51:21

我的新功能是从鼻窦取角度

代码语言:javascript
复制
Function SinusWinkel(Sinus As Double) As Double
  'To get the angle for the value of the overgiven sinus-value we can only guess and this we do by
  'going throug the sume of angle in a triangle, that is 90° or in sin 0,412118485
  'the range is consequently -0,412118485 to 0,412118485
  'A negative sin can result wether of a location east of Greenwich or a cours east to west.
  'This sub is determined to transformed to a function tha returns the angle to the cell.
  'therefore it's implemented in an own module to get rid of it when necessary.
  Dim i, k, l, d As Double
  For i = -0.412118485 To 0.412118485
    l = Sin(i)
    d = Abs(Sinus) - Abs(l)
    If (d) > k Then
      Exit For
    End If
    k = d
  Next
  SinusWinkel = k
End Function

我在一个包含位置的工作表中使用这个函数,它是纬度和经度,纬度的差异是我的鼻窦,但是要导航,我需要角度。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72538411

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档