1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <file/fcode.hxx>
24 namespace connectivity::file
27 Returns the absolute value of X:
35 class OOp_Abs
: public OUnaryOperator
38 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
42 Returns the sign of the argument as -1, 0, or 1, depending on whether X is negative, zero, or positive:
52 class OOp_Sign
: public OUnaryOperator
55 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
60 Modulo (like the % operator in C). Returns the remainder of N divided by M:
62 > SELECT MOD(234, 10);
71 class OOp_Mod
: public OBinaryOperator
74 virtual ORowSetValue
operate(const ORowSetValue
& lhs
,const ORowSetValue
& rhs
) const override
;
78 Returns the largest integer value not greater than X:
82 > SELECT FLOOR(-1.23);
86 class OOp_Floor
: public OUnaryOperator
89 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
93 Returns the smallest integer value not less than X:
95 > SELECT CEILING(1.23);
97 > SELECT CEILING(-1.23);
101 class OOp_Ceiling
: public OUnaryOperator
104 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
109 Returns the argument X, rounded to the nearest integer. With two arguments rounded to a number to D decimals.
111 > SELECT ROUND(-1.23);
113 > SELECT ROUND(-1.58);
115 > SELECT ROUND(1.58);
117 > SELECT ROUND(1.298, 1);
119 > SELECT ROUND(1.298, 0);
121 > SELECT ROUND(23.298, -1);
124 class OOp_Round
: public ONthOperator
127 virtual ORowSetValue
operate(const std::vector
<ORowSetValue
>& lhs
) const override
;
131 Returns the value of e (the base of natural logarithms) raised to the power of X:
138 class OOp_Exp
: public OUnaryOperator
141 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
145 Returns the natural logarithm of X:
153 class OOp_Ln
: public OUnaryOperator
156 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
161 If called with one parameter, this function returns the natural logarithm of X:
168 If called with two parameters, this function returns the logarithm of X for an arbitrary base B:
170 > SELECT LOG(2,65536);
175 class OOp_Log
: public ONthOperator
178 virtual ORowSetValue
operate(const std::vector
<ORowSetValue
>& lhs
) const override
;
182 Returns the base-10 logarithm of X:
188 > SELECT LOG10(-100);
191 class OOp_Log10
: public OUnaryOperator
194 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
198 Returns the value of X raised to the power of Y:
205 class OOp_Pow
: public OBinaryOperator
208 virtual ORowSetValue
operate(const ORowSetValue
& lhs
,const ORowSetValue
& rhs
) const override
;
212 Returns the non-negative square root of X:
219 class OOp_Sqrt
: public OUnaryOperator
222 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
226 Returns the value of PI. The default shown number of decimals is 5, but internally uses the full double precision for PI.
230 > SELECT PI()+0.000000000000000000;
231 -> 3.141592653589793238
234 class OOp_Pi
: public ONthOperator
237 virtual ORowSetValue
operate(const std::vector
<ORowSetValue
>& lhs
) const override
;
241 Returns the cosine of X, where X is given in radians:
246 class OOp_Cos
: public OUnaryOperator
249 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
253 Returns the sine of X, where X is given in radians:
259 class OOp_Sin
: public OUnaryOperator
262 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
265 Returns the tangent of X, where X is given in radians:
267 > SELECT TAN(PI()+1);
270 class OOp_Tan
: public OUnaryOperator
273 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
277 Returns the arc cosine of X, that is, the value whose cosine is X. Returns NULL if X is not in the range -1 to 1:
281 > SELECT ACOS(1.0001);
286 class OOp_ACos
: public OUnaryOperator
289 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
293 Returns the arc sine of X, that is, the value whose sine is X. Returns NULL if X is not in the range -1 to 1:
297 > SELECT ASIN('foo');
300 class OOp_ASin
: public OUnaryOperator
303 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
307 Returns the arc tangent of X, that is, the value whose tangent is X:
314 class OOp_ATan
: public OUnaryOperator
317 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
321 Returns the arc tangent of the two variables X and Y. It is similar to calculating the arc tangent of Y / X, except that the signs of both arguments are used to determine the quadrant of the result:
323 > SELECT ATAN2(-2,2);
325 > SELECT ATAN2(PI(),0);
329 class OOp_ATan2
: public OBinaryOperator
332 virtual ORowSetValue
operate(const ORowSetValue
& lhs
,const ORowSetValue
& rhs
) const override
;
336 Returns the argument X, converted from radians to degrees:
338 > SELECT DEGREES(PI());
341 class OOp_Degrees
: public OUnaryOperator
344 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
348 Returns the argument X, converted from degrees to radians:
350 > SELECT RADIANS(90);
354 class OOp_Radians
: public OUnaryOperator
357 virtual ORowSetValue
operate(const ORowSetValue
& lhs
) const override
;
362 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */