~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to macros/m2sci/sci_files/sci_log2.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function [tree]=sci_log2(tree)
 
2
// Copyright INRIA
 
3
// M2SCI function
 
4
// Conversion function for Matlab log2()
 
5
// Input: tree = Matlab funcall tree
 
6
// Ouput: tree = Scilab equivalent for tree
 
7
// V.C.
 
8
 
 
9
// %c_log2/%c_frexp and %b_log2/%b_frexp are not defined in Scilab
 
10
X = getrhs(tree)
 
11
X = convert2double(X)
 
12
tree.rhs=Rhs(X)
 
13
 
 
14
// Y = log2(X)
 
15
if lhs==1 then
 
16
  tree.lhs(1).infer=X.infer
 
17
// [F,E] = log2(X)
 
18
else
 
19
  if is_complex(X) then
 
20
    X = Funcall("real",1,list(X),list(Variable("",X.infer)))
 
21
  elseif ~is_real(X) then
 
22
    newX = Funcall("real",1,list(X),list(Variable("",X.infer)))
 
23
    repl_poss(newX,X,X,"is real");
 
24
    X=newX
 
25
  end
 
26
  tree.rhs=Rhs(X)
 
27
  tree.name="frexp"
 
28
  tree.lhs(1).dims=X.dims
 
29
  tree.lhs(1).type=Type(Double,Real)
 
30
end
 
31
 
 
32
endfunction