diff --git a/pd/src/d_math.c b/pd/src/d_math.c
index 59e6d989b80b7064313ba50c102f6a3043a66129..e90984938cc9e4c62fb556bcf6a72aed92998438 100644
--- a/pd/src/d_math.c
+++ b/pd/src/d_math.c
@@ -660,12 +660,10 @@ t_int *pow_tilde_perform(t_int *w)
     int n = (int)(w[4]);
     while (n--)
     {
-        t_float f = *in1++;
-        if (f > 0)
-            *out = pow(f, *in2);
-        else *out = 0;
-        out++;
-        in2++;
+        t_sample f1 = *in1++, f2 = *in2++;
+        *out++ = (f1 == 0 && f2 < 0) ||
+            (f1 < 0 && (f2 - (int)f2) != 0) ?
+            0 : pow(f1, f2);
     }
     return (w+5);
 }
@@ -678,11 +676,10 @@ t_int *scalarpow_tilde_perform(t_int *w)
     int n = (int)(w[4]);
     while (n--)
     {
-        t_float f = *in++;
-        if (f > 0)
-            *out = pow(f, g);
-        else *out = 0;
-        out++;
+        t_sample f1 = *in++;
+        *out++ = (f1 == 0 && g < 0) ||
+            (f1 < 0 && (g - (int)g) != 0) ?
+            0 : pow(f1, g);
     }
     return(w+5);
 }
diff --git a/scripts/regression_tests.pd b/scripts/regression_tests.pd
index e8f29fc6eca1e8b1f09661edbd81c3bae5c9f5b8..af06729fe90d15f2662ec9080e59b6473be54d4d 100644
--- a/scripts/regression_tests.pd
+++ b/scripts/regression_tests.pd
@@ -1,4 +1,4 @@
-#N canvas 244 48 750 572 12;
+#N canvas 245 72 750 572 12;
 #X obj 465 281 r \$0-result;
 #X obj 212 239 bng 15 250 50 0 empty empty Run_all 17 7 0 10 -262144
 -1 -1;
@@ -25,7 +25,7 @@ is handy for some binbuf tests.;
 #X obj 198 659 rtest makefilename_double_percent;
 #X obj 198 710 rtest makefilename_code_coverage;
 #N canvas 461 242 450 323 (subpatch) 0;
-#X restore 201 2555 pd;
+#X restore 201 2605 pd;
 #X obj 198 761 rtest makefilename_default;
 #X obj 198 812 rtest makefilename_default_bang;
 #X obj 198 863 rtest makefilename_float;
@@ -64,6 +64,7 @@ is handy for some binbuf tests.;
 #X obj 198 2306 rtest log_base;
 #X obj 198 2361 rtest inlet~_no_fwd;
 #X obj 198 2416 rtest inlet~_fwd_large_message;
+#X obj 198 2471 rtest pow~_negative_numbers;
 #X connect 0 0 27 0;
 #X connect 1 0 4 0;
 #X connect 2 0 42 0;
@@ -113,3 +114,4 @@ is handy for some binbuf tests.;
 #X connect 55 0 56 0;
 #X connect 56 0 57 0;
 #X connect 57 0 58 0;
+#X connect 58 0 59 0;
diff --git a/scripts/regression_tests/pow~_negative_numbers.pd b/scripts/regression_tests/pow~_negative_numbers.pd
new file mode 100644
index 0000000000000000000000000000000000000000..96bf34e6a42467c6b67a0bd9081f956c6449a1b9
--- /dev/null
+++ b/scripts/regression_tests/pow~_negative_numbers.pd
@@ -0,0 +1,27 @@
+#N canvas 320 117 911 463 12;
+#X obj 41 28 inlet;
+#X obj 41 404 outlet;
+#X msg 41 56 bang;
+#X msg 41 135 -2;
+#X obj 41 164 ../utils/sigtofloat~ pow~ 2;
+#X obj 41 193 == 4;
+#X obj 41 222 list append pow~ should handle negative numbers correctly
+for integer powers;
+#X obj 41 85 trigger bang bang;
+#X msg 461 135 -2;
+#X obj 461 164 ../utils/sigtofloat~ pow~ 2.5;
+#X obj 461 222 list append pow~ should output zero for negative numbers
+when given a non-integer power;
+#X obj 461 193 == 0;
+#X connect 0 0 2 0;
+#X connect 2 0 7 0;
+#X connect 3 0 4 0;
+#X connect 4 0 5 0;
+#X connect 5 0 6 0;
+#X connect 6 0 1 0;
+#X connect 7 0 3 0;
+#X connect 7 1 8 0;
+#X connect 8 0 9 0;
+#X connect 9 0 11 0;
+#X connect 10 0 1 0;
+#X connect 11 0 10 0;
diff --git a/scripts/regression_tests/wrap~_compatibility_bug.pd b/scripts/regression_tests/wrap~_compatibility_bug.pd
index d5fb2e3fb456e867e07cebe82b030d68879ac1ce..ceacda737e92670e2ec2b86ac83086eec6a5eda0 100644
--- a/scripts/regression_tests/wrap~_compatibility_bug.pd
+++ b/scripts/regression_tests/wrap~_compatibility_bug.pd
@@ -1,4 +1,4 @@
-#N canvas 78 98 647 470 12;
+#N canvas 79 122 647 470 12;
 #X obj 18 15 inlet;
 #X obj 508 171 ../utils/sigtofloat~ wrap~;
 #X floatatom 508 200 5 0 0 0 - - -, f 5;
diff --git a/scripts/utils/sigtofloat~.pd b/scripts/utils/sigtofloat~.pd
index 91c1059ad76a855281b1e0e5b53749ed16a2c140..6fdc6302e30a8154bd9c29d1571eec33986ef475 100644
--- a/scripts/utils/sigtofloat~.pd
+++ b/scripts/utils/sigtofloat~.pd
@@ -1,6 +1,5 @@
-#N canvas 738 437 450 381 12;
+#N canvas 739 461 450 381 12;
 #X obj 26 20 inlet;
-#X obj 149 160 \$1;
 #X obj 149 134 sig~;
 #X obj 149 189 snapshot~;
 #X obj 26 76 t b b a b;
@@ -14,15 +13,16 @@
 float is converted to leftmost signal inlet. A single block is computed
 to generate the float output.;
 #X obj 149 218 outlet;
-#X connect 0 0 4 0;
-#X connect 1 0 3 0;
-#X connect 2 0 1 0;
-#X connect 3 0 12 0;
-#X connect 4 0 8 0;
-#X connect 4 1 7 0;
-#X connect 4 2 2 0;
-#X connect 4 3 5 0;
-#X connect 5 0 6 0;
+#X obj 149 160 \$@;
+#X connect 0 0 3 0;
+#X connect 1 0 12 0;
+#X connect 2 0 11 0;
+#X connect 3 0 7 0;
+#X connect 3 1 6 0;
+#X connect 3 2 1 0;
+#X connect 3 3 4 0;
+#X connect 4 0 5 0;
+#X connect 7 0 8 0;
+#X connect 7 1 2 0;
 #X connect 8 0 9 0;
-#X connect 8 1 3 0;
-#X connect 9 0 10 0;
+#X connect 12 0 2 0;