/usr/lib/libreoffice/share/extensions/DmathsAddon/Dmaths2/NumberFunctions.xba is in libreoffice-dmaths 3.4+dfsg1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="NumberFunctions" script:language="StarBasic">'************************************************
'Copyright (C) Andy Lewis. (lewiss@ntlworld.com)
'téléchargé sur www.ooomacros.org
'
'This library is free software; you can redistribute it and/or
'modify it under the terms of the GNU Lesser General Public Licence (LGPL)
'as published by the Free Software Foundation; either
'version 2.1 of the License, or (at your option) any later version.
'This library is distributed in the hope that it will be useful,
'but WITHOUT ANY WARRANTY; without even the implied warranty of
'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
'General Public License for more details.
'You should have received a copy of the GNU General Public Licence (GPL)
'along with this library; if not, write to the Free Software
'Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'************************************************
'Various functions to handle numbers
Option Explicit
Function log10(X) As Double
log10 = Log(X) / Log(10#)
End Function
Function max (a, b)
If a= notdef and b=notdef then
max=notdef
ElseIf a = notdef or (b<>notdef and a < b) Then
max = b
Else
max = a
End If
End Function
Function min (a, b)
If a= notdef and b=notdef then
min=notdef
ElseIf a < b or b=notdef Then
min = a
Else
min = b
End If
End Function
Function randint (a, b)
randint = Int((b - a + 1) * Rnd + a)
End Function
Function Round (X, n As Integer)
Dim p As Double, nn As Integer
If Abs(n) > 10 Then nn = 10 * Sgn(n) Else nn = n
p = 10 ^ nn: Round = Int(X * p + .5) / p
End Function
Function RoundUp (X, n As Integer)
Dim p As Double, nn As Integer
If Abs(n) > 10 Then nn = 10 * Sgn(n) Else nn = n
p = 10 ^ nn: RoundUp = Int(X * p + 1) / p
End Function
Function RoundDown (X, n As Integer)
Dim p As Double, nn As Integer
If Abs(n) > 10 Then nn = 10 * Sgn(n) Else nn = n
p = 10 ^ nn: RoundDown = Int(X * p) / p
End Function
Function Roundscale (range, mindivs, optional y as integer) As Single
Dim X, L, xx As Single
If range = 0 Then Roundscale = 1: Exit Function
If mindivs < 2 Then Roundscale = range: Exit Function
X = CDbl(range / (mindivs - 1)): L = 10 ^ Int(log10(X)): xx = X / L
If xx <= 2 Then Y = 1 Else If xx <= 5 Then Y = 2 Else If xx <= 10 Then Y = 5 Else Y = 10
Roundscale = Y * L
End Function
Function roundsf (X, n As Integer)
Dim L, xx As Double
If X = 0 Then
roundsf = 0
Else
L = 10 ^ Int(log10(Abs(X))): xx = X / L
roundsf = Round(xx, n - 1) * L
End If
End Function
</script:module>
|