ceil

ceil — Returns the smallest integer not less than x

Description

Returns the smallest integer not less than x

Syntax

ceil(x) (init-, control-, or audio-rate arg allowed)

where the argument within the parentheses may be an expression. Value converters perform arithmetic translation from units of one kind to units of another. The result can then be a term in a further expression.

Examples

Here is an example of the ceil opcode. It uses the file ceil.csd.

Example 103. Example of the ceil opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
 
; Select audio/midi flags here according to platform
; Audio out   Audio in    No messages
-odac     ;;;RT audio out
;-iadc    ;;;uncomment -iadc if RT audio input is needed too

</CsOptions>
<CsInstruments>
 

sr = 44100
ksmps = 32
nchnls = 2

instr 1 

inum = p4 
iceil = ceil(inum) 
print iceil 

endin 

</CsInstruments>
<CsScore>
 

i 1 0 0 1 
i . . . 0.999999 
i . . . 0.000001 
i . . . 0 
i . . . -0.0000001 
i . . . -0.9999999 
i . . . -1 
e 
</CsScore>
</CsoundSynthesizer>


Its output should include lines like:

instr 1:  iceil = -1.000
instr 1:  iceil = 1.000
instr 1:  iceil = 1.000
instr 1:  iceil = 1.000
instr 1:  iceil = 0.000
instr 1:  iceil = 0.000
instr 1:  iceil = 0.000
      

See Also

abs, exp, int, log, log10, i, sqrt

Credits

Author: Istvan Varga
New in Csound 5
2005