Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mlx/backend/metal/kernels/erf.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#pragma once
#include <metal_math>
#include "mlx/backend/metal/kernels/expm1f.h"

/*
* Approximation to the error function.
Expand All @@ -23,8 +24,7 @@ float erf(float a) {
r = metal::fma(r, t, -6.34846687e-1f); // -0x1.450aa0p-1
r = metal::fma(r, t, -1.28717512e-1f); // -0x1.079d0cp-3
r = metal::fma(r, t, -t);
// TODO, replace with expm1 when implemented
r = 1.0f - metal::exp(r);
r = -expm1f(r);
r = metal::copysign(r, a);
} else {
// maximum error 0.98929 ulp
Expand Down
Loading