Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
purr-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sanket Bhukan
purr-data
Commits
788e4f2d
Commit
788e4f2d
authored
4 years ago
by
Jonathan Wilkes
Browse files
Options
Downloads
Patches
Plain Diff
add inlet and arg for base, update docs
parent
1387f9b7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pd/doc/5.reference/log-help.pd
+29
-17
29 additions, 17 deletions
pd/doc/5.reference/log-help.pd
pd/src/x_arithmetic.c
+22
-12
22 additions, 12 deletions
pd/src/x_arithmetic.c
with
51 additions
and
29 deletions
pd/doc/5.reference/log-help.pd
+
29
−
17
View file @
788e4f2d
#N canvas
428 6
0 555 619 10;
#N canvas
626 7
0 555 619 10;
#X obj 0 595 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0
#X obj 0 595 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0
14 -228856 -66577 0;
14 -228856 -66577 0;
#X obj 0 0 cnv 15 552 40 empty \$0-pddp.cnv.header log 3 12 0 18 -204280
#X obj 0 0 cnv 15 552 40 empty \$0-pddp.cnv.header log 3 12 0 18 -204280
-1 0;
-1 0;
#X obj 0
38
9 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13
#X obj 0
29
9 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13
-228856 -1 0;
-228856 -1 0;
#N canvas 483 285 494 344 META 0;
#N canvas 483 285 494 344 META 0;
#X text 12 105 LIBRARY internal;
#X text 12 105 LIBRARY internal;
...
@@ -21,13 +21,12 @@ for Pd version 0.42.;
...
@@ -21,13 +21,12 @@ for Pd version 0.42.;
#X text 12 85 OUTLET_0 float;
#X text 12 85 OUTLET_0 float;
#X text 12 165 RELEASE_DATE 1997;
#X text 12 165 RELEASE_DATE 1997;
#X restore 500 597 pd META;
#X restore 500 597 pd META;
#X obj 0 4
5
4 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0
#X obj 0 4
1
4 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0
13 -228856 -1 0;
13 -228856 -1 0;
#X obj 0 4
9
1 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12
#X obj 0 4
5
1 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12
0 13 -228856 -1 0;
0 13 -228856 -1 0;
#X obj 0 518 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 12
#X obj 0 518 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 12
0 13 -228856 -1 0;
0 13 -228856 -1 0;
#X text 98 495 (none);
#N canvas 215 516 428 109 Related_objects 0;
#N canvas 215 516 428 109 Related_objects 0;
#X obj 1 1 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0
#X obj 1 1 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0
14 -204280 -1 0;
14 -204280 -1 0;
...
@@ -45,22 +44,22 @@ for Pd version 0.42.;
...
@@ -45,22 +44,22 @@ for Pd version 0.42.;
#X text 7 1 [log] Related Objects;
#X text 7 1 [log] Related Objects;
#X obj 181 42 exp;
#X obj 181 42 exp;
#X restore 101 597 pd Related_objects;
#X restore 101 597 pd Related_objects;
#X obj 78 3
9
8 cnv 17 3 45 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856
#X obj 78 3
0
8 cnv 17 3 45 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856
-162280 0;
-162280 0;
#X text 98 3
9
7 float;
#X text 98 3
0
7 float;
#X text 98
41
7 list;
#X text 98
32
7 list;
#X text 98 4
6
2 float;
#X text 98 4
2
2 float;
#X obj 78 4
6
3 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856
#X obj 78 4
2
3 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856
-162280 0;
-162280 0;
#X floatatom 239
2
17 0 0 0 0 - - -;
#X floatatom 239 1
7
7 0 0 0 0 - - -;
#X floatatom 239 1
6
0 0 0 0 0 - - -;
#X floatatom 239 1
2
0 0 0 0 0 - - -;
#X text 94 2
7
4 [log] will output the natural logarithm (base E) of
#X text 94 2
3
4 [log] will output the natural logarithm (base E) of
a number. The value of zero will produce "-1000" which represents "negative
a number. The value of zero will produce "-1000" which represents "negative
infinity".;
infinity".;
#X obj 239 1
9
0 log;
#X obj 239 1
5
0 log;
#X obj 515 9 log;
#X obj 515 9 log;
#X text 11 23 natural logarithm of a number;
#X text 11 23 natural logarithm of a number;
#X text 168
41
7 - a list will be truncated \, and the first element
#X text 168
30
7 - a list will be truncated \, and the first element
will be used as input.;
will be used as input.;
#X obj 4 597 pddp/pddplink all_about_help_patches.pd -text Usage Guide
#X obj 4 597 pddp/pddplink all_about_help_patches.pd -text Usage Guide
;
;
...
@@ -70,5 +69,18 @@ will be used as input.;
...
@@ -70,5 +69,18 @@ will be used as input.;
#X obj 98 548 pddp/pddplink otherbinops-help.pd;
#X obj 98 548 pddp/pddplink otherbinops-help.pd;
#X obj 98 568 pddp/pddplink math-help.pd;
#X obj 98 568 pddp/pddplink math-help.pd;
#X text 217 568 - higher math objects;
#X text 217 568 - higher math objects;
#X connect 15 0 17 0;
#X floatatom 282 118 5 0 0 1 base_value - -, f 5;
#X connect 17 0 14 0;
#X obj 33 148 log 2;
#X floatatom 33 173 5 0 0 0 - - -, f 5;
#X floatatom 33 120 5 0 0 0 - - -, f 5;
#X obj 78 358 cnv 17 3 30 empty \$0-pddp.cnv.let.0 1 5 9 0 16 -228856
-162280 0;
#X text 98 357 float;
#X text 168 357 - set the base;
#X text 78 485 1) float;
#X text 138 485 - set the base;
#X connect 14 0 16 0;
#X connect 16 0 13 0;
#X connect 27 0 16 1;
#X connect 28 0 29 0;
#X connect 30 0 28 0;
This diff is collapsed.
Click to expand it.
pd/src/x_arithmetic.c
+
22
−
12
View file @
788e4f2d
...
@@ -636,19 +636,28 @@ static void sqrt_float(t_object *x, t_float f)
...
@@ -636,19 +636,28 @@ static void sqrt_float(t_object *x, t_float f)
outlet_float
(
x
->
ob_outlet
,
r
);
outlet_float
(
x
->
ob_outlet
,
r
);
}
}
static
t_class
*
log_class
;
/* ----------- log --------------- */
static
t_class
*
binop1_
log_class
;
/* ----------- log --------------- */
static
void
*
log_new
(
void
)
static
void
*
binop1_
log_new
(
t_floatarg
f
)
{
{
t_object
*
x
=
(
t_object
*
)
pd_new
(
log_class
);
return
(
binop1_new
(
binop1_log_class
,
f
));
outlet_new
(
x
,
&
s_float
);
return
(
x
);
}
}
static
void
log_float
(
t_object
*
x
,
t_float
f
)
static
void
binop1_log_bang
(
t_binop
*
x
)
{
{
t_float
r
=
(
f
>
0
?
LOG
(
f
)
:
-
1000
);
t_float
r
;
outlet_float
(
x
->
ob_outlet
,
r
);
if
(
x
->
x_f1
<=
0
)
r
=
-
1000
;
else
if
(
x
->
x_f2
<=
0
)
r
=
LOG
(
x
->
x_f1
);
else
r
=
LOG
(
x
->
x_f1
)
/
LOG
(
x
->
x_f2
);
outlet_float
(
x
->
x_obj
.
ob_outlet
,
r
);
}
static
void
binop1_log_float
(
t_binop
*
x
,
t_float
f
)
{
x
->
x_f1
=
f
;
binop1_log_bang
(
x
);
}
}
static
t_class
*
exp_class
;
/* ----------- exp --------------- */
static
t_class
*
exp_class
;
/* ----------- exp --------------- */
...
@@ -791,6 +800,11 @@ void x_arithmetic_setup(void)
...
@@ -791,6 +800,11 @@ void x_arithmetic_setup(void)
class_addbang
(
binop1_min_class
,
binop1_min_bang
);
class_addbang
(
binop1_min_class
,
binop1_min_bang
);
class_addfloat
(
binop1_min_class
,
(
t_method
)
binop1_min_float
);
class_addfloat
(
binop1_min_class
,
(
t_method
)
binop1_min_float
);
binop1_log_class
=
class_new
(
gensym
(
"log"
),
(
t_newmethod
)
binop1_log_new
,
0
,
sizeof
(
t_binop
),
0
,
A_DEFFLOAT
,
0
);
class_addbang
(
binop1_log_class
,
binop1_log_bang
);
class_addfloat
(
binop1_log_class
,
(
t_method
)
binop1_log_float
);
/* ------------------ binop2 ----------------------- */
/* ------------------ binop2 ----------------------- */
binop2_ee_class
=
class_new
(
gensym
(
"=="
),
(
t_newmethod
)
binop2_ee_new
,
0
,
binop2_ee_class
=
class_new
(
gensym
(
"=="
),
(
t_newmethod
)
binop2_ee_new
,
0
,
...
@@ -911,10 +925,6 @@ void x_arithmetic_setup(void)
...
@@ -911,10 +925,6 @@ void x_arithmetic_setup(void)
sizeof
(
t_object
),
0
,
0
);
sizeof
(
t_object
),
0
,
0
);
class_addfloat
(
sqrt_class
,
(
t_method
)
sqrt_float
);
class_addfloat
(
sqrt_class
,
(
t_method
)
sqrt_float
);
log_class
=
class_new
(
gensym
(
"log"
),
log_new
,
0
,
sizeof
(
t_object
),
0
,
0
);
class_addfloat
(
log_class
,
(
t_method
)
log_float
);
exp_class
=
class_new
(
gensym
(
"exp"
),
exp_new
,
0
,
exp_class
=
class_new
(
gensym
(
"exp"
),
exp_new
,
0
,
sizeof
(
t_object
),
0
,
0
);
sizeof
(
t_object
),
0
,
0
);
class_addfloat
(
exp_class
,
(
t_method
)
exp_float
);
class_addfloat
(
exp_class
,
(
t_method
)
exp_float
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment